how can I get the below to compile in Borland 5.02
[code]
#include <windows.h>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
MessageBox(NULL, "Hello world!", "Sample", MB_OK);
return 0;
}
[/code
how can I get the below to compile in Borland 5.02
[code]
#include <windows.h>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
MessageBox(NULL, "Hello world!", "Sample", MB_OK);
return 0;
}
[/code
AIM: MarderIII
You need to add parameter names to your function!
Code:// function prototype (which you're not doing, you're adding code) // both these lines are the same void blah(int,int); void blah(int a, int b); // correct with code void blah(int a, int b) { /*...*/ }
I dont understand what you are trying to tell me.
AIM: MarderIII
What error message do you get when you compile?
Speedy5 is trying to tell you that HINSTANCE, LPSTR, and int are DATA TYPES, not variable values! I don't have my windows programming book with me, and I don't remember how to get these values. But, they are supposed to come from an existing window. HINSTANCE = handle to window instance, LPSTR = long pointer to string,, you know what an int is.. (I think the 2nd HINSTANCE can be NULL?)I dont understand what you are trying to tell me.
You have to pass values (or pointers, or references) to a function.
Windows programming is NOT EASY! But I think there are some short-cuts if you just want a message box.
BTW - The datatypes are the just the "normal" types renamed with "typedef" in windows.h
From Microsoft Visual C++ documentation:Code:#include <windows.h> int main() { char Message[] = "Here's the message!!!"; char Title[] = "My Message Box"; int Button = MB_OK; // Defined in windows.h MessageBox(NULL, Message, Title, Button); return 0; }
int MessageBox(
HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);
I assume that the borland compiler is similar.
Last edited by DougDbug; 02-10-2003 at 10:31 PM.