Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / a simple messagebox(great for debugging)

Author
Message
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 23rd Jun 2008 10:02 Edited at: 23rd Jun 2008 12:05
all you gotta do is grab some win32 stuffs:



self-explanatory.

part of a personal library i'm working on in my spare time.

Keep in mind it will stop your program mid-Sync
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 23rd Jun 2008 10:05
Huh? Use this:



You don't need the library or anything...

If you can do any models for FW, reply to the FleetWars thread.

Click here!
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 23rd Jun 2008 10:07
no way?
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 23rd Jun 2008 10:27
i don't think so. my compiler does not recognize that function you're using.
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 23rd Jun 2008 16:10
Holy crap, mine has that function.
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 23rd Jun 2008 16:17
Zuka: Parameters. What parameters do I use? Looked over it's definition in the WinUser.h file, can't figure it out, to be honest. ( A lot of interesting code in there, though )
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 23rd Jun 2008 18:31
That function is explained in the documentation that comes with C++. If you've included windows.h, there should be no issue in using it. AFAIK, GDK templates link to user32.lib, but a Win32 template might not, so you might need to link explicitly to user32.lib

The function prototype looks like this:
MessageBoxA(
__in_opt HWND hWnd,
__in_opt LPCSTR lpText,
__in_opt LPCSTR lpCaption,
__in UINT uType);

hWnd = parent window (can be NULL)
lpText = text to display in the message box
lpCaption = title
uType = message box type. The list of legal types is listed in there, too. You can combine types using or, but in this case...it is usually unnecessary. They are defined right above the function prototype, under the heading MessageBox() flags. (They all begin "MB_")

You should never use the form "MessageBoxA" in a C++ program, you should let the state of UNICODE do that, like it was intended. The MessageBoxA form is for non-UNICODE apps, and the "MessageBoxW" is for UNICODE apps. Just use "MessageBox".
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 23rd Jun 2008 19:40
Well, works fine for me. Where do you learn this crap, jinzai?!

If you can do any models for FW, reply to the FleetWars thread.

Click here!
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 24th Jun 2008 01:39
He read over the windows header files. I look through the same one myself, just didn't know a few of the things he mentioned.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 24th Jun 2008 09:02
on the msdn page:

Quote: "
Header - Declared in Winuser.h, include Windows.h
Import library - User32.lib
"


http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx


will it work if i only include Windows.h?
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 24th Jun 2008 14:14 Edited at: 24th Jun 2008 14:16
No, I don't usually read include files until there's a problem, or if I want to use a function from DBPro and I need the constant declarations. I use the documentation that I have. MSDN documentation, and the Platform SDK. If you download the full documentation and set your help to use local help, it is simply a matter of searching for what you need.

Reading include files is not a very efficient way to learn the Windows APIs. The help files are really the best method, and using them offline is much better than using them online. Also, They have TOCs, and every function is grouped by the area it pertains to. Each help page on a function tells you what include files you need, the prototype, and what the various parameters are. Many have sample code, or links to sample code. Finally, there are all kinds of white papers describing Windows subsystems.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 24th Jun 2008 17:42
Quote: "The help files are really the best method"


But they're still written by people who understand the subject intimately. Unfortunately for me they frequently don't talk down to my level. I find this particularly so in the the .NET arena where the documentation seems to be written to encompass the C#, VB and everything else with little more than a brief explanation and examples for each language.

Sometimes you have to RTFM (which means going out and getting one) before much of it makes sense. I have a long distance friend who writes technical books, mostly on Windows stuff, and all I get out of it is how to use Visual Studio.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 24th Jun 2008 18:29
I usually look at the MSDN library, also. It just was a clip of code letter-for-letter from the header, so I assumed you did the same of me.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 26th Jun 2008 02:48
so does anyone think this is a good contribution?
dbGamerX
16
Years of Service
User Offline
Joined: 23rd Nov 2007
Location:
Posted: 26th Jun 2008 05:45
Definitely! I don't care if there are other ways or even simpler ways to do this, guys, but we should appreciate his contribution. Now I can finally add a message box (without including windows.h and a bunch of other crap). Thanks!

elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 27th Jun 2008 00:54
Yes!!
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 27th Jun 2008 00:56
just remember...

Quote: "Keep in mind it will stop your program mid-Sync"


it might be fixable, though. MessageBox() has a lot of interesting flags.
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 27th Jun 2008 01:02 Edited at: 27th Jun 2008 01:02
Its not fixable by using MessageBox. MessageBox is a modal dialog. You need a modeless dialog to do that. It is doable, but...you won't be able to back door it in the way you've done with MessageBox...you'll have to use the Win32 API in the way Microsoft intended.

I can post code if you want.
elantzb
16
Years of Service
User Offline
Joined: 10th May 2008
Location: Classified
Posted: 27th Jun 2008 04:11
go ahead.

~you can call me lantz~

Login to post a reply

Server time is: 2024-09-30 01:27:49
Your offset time is: 2024-09-30 01:27:49