Has anybody tried using WinMain function in VB? I am having trouble in using it.
Printable View
Has anybody tried using WinMain function in VB? I am having trouble in using it.
What kind of trouble?
perhaps if you post or e-mail me your code and problems, I can help you.
Gerco.
Why would you use WinMain in VB?
Isn't it called 'WinMain' in VB?
I Think This would help
In A Module Enter The Code
sub main()
'' Startup Code
end sub
__
Go to the project Properties and Select The Startup To Sub Main. and That's It.
Ex:
Sub Main()
form1.show
end sub
We are not talking about Sub Main, but its about using the WinMain function that we use while programming through Win32 API .
The WinMain() function is not an API function. It is a entry point required by the VC++ compiler to create a WIN32 application in Visual C++. It has nothing to do with VB. You can not call the WinMain() function because it doesn't exist in in the WIN32 API.
It's not just VC++ -- every program for windows must export the WinMain function. VB inserts its own into your program to initialise COM, the forms, etc.
You are right, one way or another there must be a WinMain() function even if you compile your VB code to P-code instead of native code. But there is no way you can get VB code into a WinMain() because this code must be in C/C++, and this is a VB form.
The closest you can get to WinMain, is the 'Main' sub in VB.