Hello! I am making a Win32 program, and I working on how to make a window... I have all the code to make it work, however, I want to make a function that I can call in order to open the window. It should work, however the problem is when I should call:
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int nshowcmd)
I understand that should be the entrance point for any Win32 API program, however, what if I want to create a "main.cpp" to call the function (to make the window) which is in a "window.h"? How would I either be able to call that function, or how would I get the parameters passed to the program when using that function call as the entrance point? All I really need are the parameters, because I need them for creating the window. Thanks for any help!
Oh, no... That is not what I want to hear. I have been programming in C++ for about three years, and I would hope that I understand function parameters... With that said, the windows operating system passes certain parameters to the program when the program uses int WINAPI WinMain as the entrance point.
Just as every C application and C++ application must have a main function as its starting point, every Win32-based application must have a WinMain function.
Disch, I don't want WinMain to be the entrance point of the program. I want to have a window class in a separate .h file, that I can include into a main.cpp file, which has a int main() function where the program starts... From there, I want to be able to call window.open(); (from my window class) which would open a window. The problem comes in when I need the parameters for the creation of the window. Main just hinstance:
I'm sorry modoran, I do not understand what you are trying to ask... I am making a small game engine that I can code in my free time, and I figured a good of a spot as any would be to make class for opening, closing, and dealing with windows. That is why I don't want to have to start in WinMain... I want the program to be as flexible as possible. So, I guess I do not want the console window, but I was going to get to that part later, because it was not my main concern as of right now... I wanted to only use C++, Windows, and OpenGL to make it. So, my next question would be if I am going at this the wrong way. Am I? If not, I'll happily just use GetModuleHandle(NULL); in order to get the hinstance I need...