Click here to Skip to main content
15,906,333 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting the process ID of an externally running application Pin
David Crow3-Jun-04 8:46
David Crow3-Jun-04 8:46 
GeneralRe: Getting the process ID of an externally running application Pin
Antony M Kancidrowski3-Jun-04 9:21
Antony M Kancidrowski3-Jun-04 9:21 
GeneralRe: Getting the process ID of an externally running application Pin
Blake Miller4-Jun-04 14:26
Blake Miller4-Jun-04 14:26 
GeneralRe: Getting the process ID of an externally running application Pin
Antony M Kancidrowski5-Jun-04 6:04
Antony M Kancidrowski5-Jun-04 6:04 
Generalusing multiple-language resource Pin
alexander chupeev3-Jun-04 5:28
alexander chupeev3-Jun-04 5:28 
GeneralRe: using multiple-language resource Pin
David Crow3-Jun-04 7:50
David Crow3-Jun-04 7:50 
GeneralRe: using multiple-language resource Pin
alexander chupeev3-Jun-04 14:54
alexander chupeev3-Jun-04 14:54 
GeneralRe: using multiple-language resource Pin
alexander chupeev4-Jun-04 6:36
alexander chupeev4-Jun-04 6:36 
Here is an example which should load russian version of menu, but it will display window with english menu. Why?

------------- sh ./eg.sh ------------------
#!/bin/sh
cat > generic.c << EOF
#include <windows.h>
#include <tchar.h>
#include <windowsx.h>

#define NAMESTART 16

WNDPROC Listbox_WindowProc;

BOOL CALLBACK Enumres_EnumProc(HMODULE hModule, \
LPCTSTR lpszType, LPCTSTR lpszName, LANGID wIDLanguage, LPARAM lParam)
{
TCHAR szItemText[NAMESTART + MAX_PATH];
HWND* hwnd = (HWND*) lParam;
wsprintf(szItemText, TEXT("%#03x %#03x - "), PRIMARYLANGID(wIDLanguage), SUBLANGID(wIDLanguage));
if (0 < GetModuleFileName(hModule, &szItemText[lstrlen(szItemText)], MAX_PATH))
{
ListBox_AddString(*hwnd, szItemText);
}
return (GetLastError() == ERROR_SUCCESS? TRUE: FALSE);
}

void Enumres_OnDestroy(HWND hwnd)
{
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) Listbox_WindowProc);
PostQuitMessage(0);
}

LRESULT CALLBACK Enumres_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
HANDLE_WM_DESTROY(hwnd, wParam, lParam, Enumres_OnDestroy);
break;
default:
return Listbox_WindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}

BOOL InitInstance(int nCmdShow)
{
LCID dwCurrLocale = MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), SORT_DEFAULT);
if (SetThreadLocale(dwCurrLocale))
{
HMENU menu = LoadMenu(NULL, TEXT("GENERIC"));
if (menu)
{
HWND hwnd = CreateWindow(
TEXT("LISTBOX"), // name of window class
TEXT("Enumres"), // title-bar string
WS_OVERLAPPEDWINDOW, // top-level window
CW_USEDEFAULT, // default horizontal position
CW_USEDEFAULT, // default vertical position
CW_USEDEFAULT, // default width
CW_USEDEFAULT, // default height
NULL, // no owner window
menu, // required menu
NULL, // handle to application instance
(LPVOID) NULL); // no window-creation data
if (hwnd)
{
Listbox_WindowProc = (WNDPROC) SetWindowLong(hwnd, GWL_WNDPROC, (LONG) Enumres_WindowProc);
if (EnumResourceLanguages(NULL, RT_MENU, TEXT("GENERIC"), Enumres_EnumProc, (LPARAM) &hwnd))
{
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
return TRUE;
}
}
}
}
return FALSE;
}

int WINAPI _tWinMain(HINSTANCE hCurrInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nCmdShow)
{
if (InitInstance(nCmdShow))
{
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return ((int) msg.wParam);
}
return 0;
DBG_UNREFERENCED_PARAMETER(hPrevInst);
DBG_UNREFERENCED_PARAMETER(lpCmdLine);
}
EOF
cat > resource.h << EOF
#define ID_FILE_NEW 100
#define ID_FILE_OPEN 101
#define ID_FILE_SAVE 102
#define ID_FILE_SAVE_AS 103
#define ID_FILE_PRINT 104
#define ID_FILE_PRINT_SETUP 105
#define ID_FILE_EXIT 106

#define ID_EDIT_UNDO 200
#define ID_EDIT_CUT 201
#define ID_EDIT_COPY 202
#define ID_EDIT_PASTE 203
#define ID_EDIT_LINK 204

#define ID_HELP_CONTENTS 300
#define ID_HELP_SEARCH 301
#define ID_HELP_HELP 302
#define ID_HELP_ABOUT 303
#define ID_HELPTOPICS 304
EOF
cat > generic.rc << EOF
#include "windows.h"
#include "winver.h"
#include "resource.h"

LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT

/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

GENERIC MENU
BEGIN
POPUP "&" c<"
BEGIN
MENUITEM "'R¤& вм\tCtrl+N", ID_FILE_NEW, GRAYED
MENUITEM "&_вЄалвм...\tCtrl+O", ID_FILE_OPEN, GRAYED
MENUITEM "&'Rеа -Ёвм\tCtrl+S", ID_FILE_SAVE, GRAYED
MENUITEM "'Rеа -Ёвм &Є Є...", ID_FILE_SAVE_AS, GRAYED
MENUITEM SEPARATOR
MENUITEM "&__з вм...\tCtrl+P", ID_FILE_PRINT, GRAYED
MENUITEM "_ а &┐_вал бва -Ёжл...", ID_FILE_PRINT_SETUP, GRAYED
MENUITEM SEPARATOR
MENUITEM "'&леR¤\tAlt+X", ID_FILE_EXIT
END
POPUP "&_а ўЄ "
BEGIN
MENUITEM "&_в┐_-Ёвм\tCtrl+Z", ID_EDIT_UNDO, GRAYED
MENUITEM SEPARATOR
MENUITEM "&'ла_ вм\tCtrl+X", ID_EDIT_CUT, GRAYED
MENUITEM "&_RЇЁаRў вм\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&'бв ўЁвм\tCtrl+V", ID_EDIT_PASTE, GRAYED
MENUITEM "'бл&<Є ", ID_EDIT_LINK, GRAYED
END
POPUP "&'Їа ўЄ "
BEGIN
MENUITEM "&'R¤_а│ -Ё_", ID_HELP_CONTENTS, HELP
MENUITEM "&_а_¤┐_в-лc гЄ  в_<м...", ID_HELP_SEARCH, HELP
MENUITEM "_ бЇ&а ўRз-Rc бЁбв_┐_", ID_HELP_HELP, HELP
MENUITEM SEPARATOR
MENUITEM "&_ ЇаR_а ┐┐_...", ID_HELP_ABOUT
END
END

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

GENERIC MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New\tCtrl+N", ID_FILE_NEW, GRAYED
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN, GRAYED
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE, GRAYED
MENUITEM "Save &As...", ID_FILE_SAVE_AS, GRAYED
MENUITEM SEPARATOR
MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT, GRAYED
MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit\tAlt+X", ID_FILE_EXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO, GRAYED
MENUITEM SEPARATOR
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT, GRAYED
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY, GRAYED
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE, GRAYED
MENUITEM "Paste &Link", ID_EDIT_LINK, GRAYED
END
POPUP "&Help"
BEGIN
MENUITEM "&Contents", ID_HELP_CONTENTS, HELP
MENUITEM "&Search for Help On...", ID_HELP_SEARCH, HELP
MENUITEM "&How to Use Help", ID_HELP_HELP, HELP
MENUITEM SEPARATOR
MENUITEM "&About Generic...", ID_HELP_ABOUT
END
END
EOF
rc generic.rc
cl /nologo /MDd /Zi /D_UNICODE /DUNICODE generic.c generic.res user32.lib
GeneralThread issue Pin
Shay Harel3-Jun-04 5:16
Shay Harel3-Jun-04 5:16 
GeneralRe: Thread issue Pin
John M. Drescher3-Jun-04 5:49
John M. Drescher3-Jun-04 5:49 
GeneralRe: Thread issue Pin
Shay Harel3-Jun-04 5:57
Shay Harel3-Jun-04 5:57 
GeneralRe: Thread issue Pin
basementman3-Jun-04 6:40
basementman3-Jun-04 6:40 
GeneralRe: Thread issue Pin
John M. Drescher3-Jun-04 7:33
John M. Drescher3-Jun-04 7:33 
Generalmemory allocation Pin
Gérald Mercet3-Jun-04 4:42
Gérald Mercet3-Jun-04 4:42 
GeneralRe: memory allocation Pin
jmkhael3-Jun-04 5:45
jmkhael3-Jun-04 5:45 
GeneralRe: SetForegroundWindow() to a Message-Window prevents a later popped parentless-modal-dialog from showing Pin
Blake Miller3-Jun-04 3:33
Blake Miller3-Jun-04 3:33 
GeneralBeginner registry problem Pin
Scozturk3-Jun-04 3:03
professionalScozturk3-Jun-04 3:03 
GeneralRe: Beginner registry problem Pin
Dominik Reichl3-Jun-04 3:12
Dominik Reichl3-Jun-04 3:12 
GeneralRe: Beginner registry problem Pin
David Crow3-Jun-04 4:12
David Crow3-Jun-04 4:12 
Generalcasting a vector Pin
Jerome Conus3-Jun-04 2:33
Jerome Conus3-Jun-04 2:33 
GeneralRe: casting a vector Pin
cgott3-Jun-04 3:07
cgott3-Jun-04 3:07 
GeneralRe: casting a vector Pin
John M. Drescher3-Jun-04 8:03
John M. Drescher3-Jun-04 8:03 
GeneralRe: casting a vector Pin
Jerome Conus3-Jun-04 19:09
Jerome Conus3-Jun-04 19:09 
GeneralRe: casting a vector Pin
Johnny ²3-Jun-04 21:41
Johnny ²3-Jun-04 21:41 
GeneralRe: casting a vector Pin
John M. Drescher4-Jun-04 7:52
John M. Drescher4-Jun-04 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.