Bonjour,
j'ai télécharger une source pour ajoute un menu dans mon jeu j'ai compiler en C, sa marche, en c++ le menu ne s'affiche pas, mais le reste de mon programme et en c++ (je vais ajouter la source a mon programme principale)
vu que je ne sais pas comment convertire le C en C++, je vous demande un peu d'aide :

main.c :
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <windows.h>
#include "module.h"

DLLEXPORT MODULE_IMPORT ImportTable = &#123;
	&#123;0x00000000, NULL&#125;,
	&#123;0x00000000, NULL&#125;
&#125;;

void FSAPI module_init&#40;void&#41; &#123;&#125;
void FSAPI module_deinit&#40;void&#41; &#123;&#125;

DLLEXPORT MODULE_LINKAGE Linkage = &#123;
	0x00000000,
	module_init,
	module_deinit,
	0,
	0,
	0x0900,	// FS2004 version &#40;use 0x0800 for FS2002&#41;
	NULL
&#125;;

WNDPROC oldWndProc;

HWND hFSimWindow;

#define	MENU_ENTRY	"My Mo&dule"
#define	ID_MY_MENUITEM	40001

LRESULT CALLBACK FSimWindowProc&#40;HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam&#41;
&#123;
	switch &#40;uMsg&#41; &#123;
		case WM_NCPAINT&#58;
			&#123;
				HMENU hMenu, hMyMenu;

				hMenu = GetMenu&#40;hwnd&#41;;
				if &#40;hMenu != NULL&#41; &#123;
					int i;
					// Look for our menu entry in the main menu.
					for &#40;i = 0; i < GetMenuItemCount&#40;hMenu&#41;; i++&#41; &#123;
						char buf&#91;128&#93;;
						GetMenuString&#40;hMenu, i, buf, 128, MF_BYPOSITION&#41;;
						if &#40;strcmp&#40;buf, MENU_ENTRY&#41; == 0&#41; &#123;
							// It is already here, we do not need to add it again
							break;
						&#125;
					&#125;
					if &#40;i < GetMenuItemCount&#40;hMenu&#41;&#41; &#123;
						// It is already here, we do not need to add it again
						break;
					&#125;
					/* Create new menu. NOTE&#58; It seems that this will be
					 * reached more times, so we cannot save the handle, because
					 * in such case it could be destroyed and we will not have
					 * any access to it in the simulator.
					 */
					hMyMenu = CreateMenu&#40;&#41;;
					AppendMenu&#40;hMyMenu, MF_STRING | MF_ENABLED, ID_MY_MENUITEM, "FlightRecorder"&#41;;
					// add the created menu to the main menu
					AppendMenu&#40;hMenu, MF_STRING | MF_POPUP, &#40;UINT_PTR&#41;hMyMenu, MENU_ENTRY&#41;;
				&#125;
			&#125;
			break;
		case WM_COMMAND&#58;
			if &#40;LOWORD&#40;wParam&#41; == ID_MY_MENUITEM&#41; &#123;
				// Add your code here
				MessageBox&#40;hwnd, "It works!", "HURA", MB_OK | MB_ICONEXCLAMATION&#41;;
				return 0;
			&#125;
			break;
	&#125;
	// Call the original window procedure to handle all other messages
	return CallWindowProc&#40;oldWndProc, hwnd, uMsg, wParam, lParam&#41;;
&#125;

/**
 * Entry point of the DLL.
 */
BOOL WINAPI DllMain&#40;HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved&#41;
&#123;
	switch &#40;fdwReason&#41; &#123;
		case DLL_PROCESS_ATTACH&#58;
			hFSimWindow = FindWindow&#40;"FS98MAIN", NULL&#41;;
			oldWndProc = &#40;WNDPROC&#41;SetWindowLong&#40;hFSimWindow, GWL_WNDPROC, &#40;LONG&#41;FSimWindowProc&#41;;
			break;
	&#125;
	return TRUE;
&#125;
module.h :
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
#ifndef	__FS_MODULE_H__
#define	__FS_MODULE_H__

#define	DLLEXPORT	__declspec&#40;dllexport&#41;
#define	FSAPI	__stdcall

/**
 * This is the module's import table definition.
 */
typedef struct _MODULE_IMPORT &#123;
	struct &#123;
		int fnID;
		PVOID fnptr;
	&#125; IMPORTSentry;
	struct &#123;
		int fnID;
		PVOID fnptr;
	&#125; nullentry;
&#125; MODULE_IMPORT;

/**
 * This is the module's export table definition
 */
typedef struct _MODULE_LINKAGE &#123;
	int ModuleID;
	void &#40;FSAPI *ModuleInit&#41;&#40;void&#41;;
	void &#40;FSAPI *ModuleDeinit&#41;&#40;void&#41;;
	UINT32 ModuleFlags;
	UINT32 ModulePriority;
	UINT32 ModuleVersion;
	PVOID ModuleTable;
&#125; MODULE_LINKAGE;

#endif	/* __FS_MODULE_H__ */
Voila merci