المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Strings



C++ Programming
05-04-2009, 02:12 AM
Hello, I'm not too experienced C coder, so I have a question:
Where I should define those strings I'll be using? In the header or where it's used? If I wrote them in the header, the result would be much like that string pooling flag in the compiler options, right? I'm trying to code a GUI (with WinAPI) and I started wondering this.

Here's an example:
main.h:const TCHAR g_lpErrorText[] = TEXT("Error!");main.c:int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, g_lpErrorText, g_lpErrorText, MB_ICONEXCLAMATION|MB_OK);
return 0;
}

OR


main.c:WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, TEXT("Error!"), TEXT("Error!"), MB_ICONEXCLAMATION|MB_OK);
return 0;
}