J'ai fait un programme qui marche sur Dev C++ mais pas sur Visual C++, dites moi pourquoi svp.
Voila mon programme :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
//****************************************
#include <windows.h>
 
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
 
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
 
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
 
{
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
 
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
//
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not 
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "VRML\0*.wrl\0All\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
 
// Display the Open dialog box. 
 
if (GetOpenFileName(&ofn)==TRUE) 
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,
0, (LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL);
return 0; 
}
//*******************************************
et voila les erreurs que j'ai :

--------------------Configuration: tabboxmanip - Win32 Debug--------------------
Compiling...
tabboxmanip.cpp
F:\Essais\manipulators3\tabboxmanip.cpp(24) : warning C4700: local variable 'hwnd' used without having been initialized
Linking...
tabboxmanip.obj : error LNK2001: unresolved external symbol _GetOpenFileNameA@4
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/tabboxmanip.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

tabboxmanip.exe - 3 error(s), 1 warning(s)