|
Hi all,
I have a strange and annoying problem with LoadMenu, I use eVC++ 4.0 for mobile apps:
When I call LoadMenu(IDR_RESOURCENAME), it fails, and when call GetLastError it gives me the error code 1814, which in MSDN says "The specified resource name cannot be found in the image file. ", so , whats the problem!! its really annoying.
my code looke like:
mnuCtxt.LoadMenu(IDR_MAIN_TOOL)
Thanx,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Ok...
After being annoyed for 4 hours, I solved the problem 2 minutes after I posted this question... just for information the problem is that u cant load a specific menu resource using LoadMenu, u must load a menu bar resource, yeaaaaaaaaaaaaaaaah!!
;P;P;P;P;P
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
can you give me more information about this?
i want to open a menu of a dialog without mouse .
thanks
-- modified at 5:20 Monday 18th September, 2006
|
|
|
|
|
if u want to open it without a mouse u should follow these steps:
1. create a new menu bar using resource editor
2. Define CMenu object and use MyMenu.LoadMenu(IDR_MENUBAR) to load the menu resource.
3. to get a specific popup menu from the bar use: pMenu=MyMenu.GetSubMenu(iIndex);
4. Use the function: TrackPopupMenu to make a popup (context menu).
Regards
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Hello Everyone, First time posting on this forum but I've been lurking for a long time. I'm starting to teach myself some basic windows programming as I want to get started on DirectX. I can create a window but I'm getting a strange error when I try to run it. The window name is coming out as a series of squares instead of the name. Here's my code:
WNDCLASSEX windowClass = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
(LPCWSTR)"Barry's D3D BaseClass", NULL };
RegisterClassEx( &windowClass );
HWND hWnd = CreateWindow( (LPCWSTR)"Barry's D3D BaseClass", (LPCWSTR)"test",
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
GetDesktopWindow(), NULL, windowClass.hInstance, NULL );
if( 1 )
{
ShowWindow( hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );
MSG mssg;
PeekMessage( &mssg, NULL, 0, 0, PM_NOREMOVE);
while (mssg.message!=WM_QUIT)
{
if (PeekMessage( &mssg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&mssg);
DispatchMessage(&mssg);
}
else
{
}
}
}
UnregisterClass( (LPCWSTR)"Barry's D3D BaseClass", windowClass.hInstance );
Its a bit of a strange problem and I'm not sure why its happening as its mainly code I've taken from text books and the msdn. Any help would really be appreciated.
|
|
|
|
|
What is obviously a problem in your code is that you cast ASCII strings to UNICODE strings everywhere.
Instead of
(LPCWSTR)"Barry's D3D BaseClass"
you better write
_T("Barry's D3D BaseClass")
If you want to have unicode strings use
L"Barry's D3D BaseClass")
And don't forget to include the header file tchar.h if you haven't already done that.
|
|
|
|
|
Thanks for the reply, I'll try this when I get home and see if that's what's causing the errors.
|
|
|
|
|
Yes that works a treat, So CreateWindowEx takes in UNICODE strings/chars as default and by just using "" I was using ASCII. Then using _T() converts ASCII to UNICODE automatically for you and that's why it works? Great to get the code fix but I'd like to understand why it worked as well.
I'm also trying something else I want to be able to use a string instead of hard coding the string parameter in quotes. Here's the code I want to use:
HWND hWnd = CreateWindow( _T("Barry's D3D BaseClass"), _T(windowName),
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,GetDesktopWindow(),
NULL, windowClass.hInstance, NULL );
This gives me the follow compile error:
c:\documents and settings\barryod\my documents\visual studio 2005\projects\directx1\directx1\directxbase.cpp(38) : error C2065: 'LwindowName' : undeclared identifier
I'm really not sure what's happening here, any help would be appreciated.
|
|
|
|
|
Just reinstalled VC++ 6.0 (with SP5) and now I am getting this ..fatal error RC1015: cannot open include file 'afxres.h'. After I put “include files” in Tools…Directories ... include ... I get “ ..fatal error RC1015: cannot open include file winres.h .
I have been reading this TN035 and cannot figure it out. I am lost.
Can anybody give me a simple sample what MFC wants to see in Tools … Directories…
Thanks very much
|
|
|
|
|
I want to create my own cursor image by importing an exsiting .ico file, but every time the VS6.0 automatically imported it into resources as ICON file, even I name it as IDC_CURSOR1, I can not use " wndclass.hCursor = LoadCursor (hInstance, MAKEINTRESOURCE (IDC_CURSOR1)) ;" to create my own cursor
|
|
|
|
|
Hi
I am trying to develop an application to capture the screen and save it into a bitmap, every thing was working fine but when I tried to capture the screen of an application that runs in a dos window it did not succeed, does any body know how to do that.
Thanx in advnace
K.A
|
|
|
|
|
Hi,
Im kinda playing with strings.
Im trying to generate this output in the console:
****
******
********
**********
************
**************
****************
And this is my code:
int _tmain(int argc, _TCHAR* argv[])
{
for( int row = 1; row <= 10; row++ )
{
for( int col = row*4; col < row*12; col+=4 )
//{
cout << '*';
cout << endl;
//}
}
system("pause");
return 0;
}
I was wondering what it is im doing wrong.
If anyone can tell me, plz do so.
Thanks in advance!
|
|
|
|
|
for(int i=4; i<=16; i+=2)
{
for(int j=0; j<i; j++)
{
cout << "*";
}
cout << "\r\n";
}
|
|
|
|
|
|
Hi,
For exporting functions from a dll written in native C++ I use :"__declspec(dllexport)".
What is the equivalent way to it for functions of the "clrcall calling convention", written in C++/CLI ?
Thanks,
Avi.
|
|
|
|
|
where i can get the gdiplus files (gdiplus.h, gdiplus.cpp) and other files that are needed;
how to include this file in my MFC project?
can somebody help me in using GDI+ ? what i must do?
thanks
erfan
|
|
|
|
|
If your using VC++ 6.0, you will need the Platform SDK. February 2003 SDK is the last one that will work with VC++ 6.0. I believe the only way to get this particular SDK is by ordering the CD at the fullfillment site. They charged me about $9-$10 for it a while back when I ordered it. (Shame on me for not downloading it while it was a free download)
If your using VC++ 7.1, there should have been an SDK installed with it (I think it was an option in the installation but I could be wrong there)
|
|
|
|
|
Once you have the SDK, I have articles on how to use GDI+ in VC6 here on CP.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear Sir;
I have six ComboBox controls on my formView.
From a search button I show data on them. But when I clic on the last to select another item, data on the second control disappears. I don't know why.
What to do so that data from one of the remain ComboBox don't disappear when I click on one of them ?
A second problem is that on another formview when I click on my search button, data is not display on some Combobox controls, but when clic one Clear button and I click for second time on search button, they appear. I don't understand this behavior of ComboBox control
I learn my self
|
|
|
|
|
Can you show a snippet code?
|
|
|
|
|
I don't know what you call by snipped code; Is it this :
void posteagent::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(posteagent)
DDX_CBString(pDX, IDC_agtlog, m_agtlog);
DDV_MaxChars(pDX, m_agtlog, 1);
DDX_CBString(pDX, IDC_catego, m_catego);
DDV_MaxChars(pDX, m_catego, 3);
DDX_CBString(pDX, IDC_codebq, m_codebq);
DDV_MaxChars(pDX, m_codebq, 10);
DDX_CBString(pDX, IDC_commis, m_commis);
DDV_MaxChars(pDX, m_commis, 1);
DDX_Text(pDX, IDC_datcom, m_datcom);
DDV_MaxChars(pDX, m_datcom, 10);
DDX_Text(pDX, IDC_datsor, m_datsor);
DDV_MaxChars(pDX, m_datsor, 10);
DDX_CBString(pDX, IDC_equipe, m_equipe);
DDV_MaxChars(pDX, m_equipe, 10);
DDX_CBString(pDX, IDC_fonction, m_fonction);
DDV_MaxChars(pDX, m_fonction, 20);
DDX_Text(pDX, IDC_grades, m_grades);
DDV_MaxChars(pDX, m_grades, 2);
DDX_Text(pDX, IDC_INSS, m_inss);
DDV_MaxChars(pDX, m_inss, 15);
DDX_Text(pDX, IDC_lniveau, m_lniveau);
DDX_Text(pDX, IDC_lsieges, m_lsieges);
DDX_CBString(pDX, IDC_Niveau, m_niveau);
DDV_MaxChars(pDX, m_niveau, 15);
DDX_CBString(pDX, IDC_siege, m_siege);
DDV_MaxChars(pDX, m_siege, 2);
DDX_CBString(pDX, IDC_sortie, m_sortie);
DDV_MaxChars(pDX, m_sortie, 1);
DDX_Text(pDX, IDC_numbq, m_numbq);
DDV_MaxChars(pDX, m_numbq, 20);
DDX_CBString(pDX, IDC_dtpaie, m_dtpaie);
DDV_MaxChars(pDX, m_dtpaie, 1);
DDX_CBString(pDX, IDC_syndicat, m_syndicat);
DDV_MaxChars(pDX, m_syndicat, 10);
//}}AFX_DATA_MAP
}
When I clic on combobox dtpaie , data disappear on grades.
And write Updatedata(false) when I click on search button so that data are shown on some controls.
|
|
|
|
|
mikobi wrote: From a search button I show data on them. But when I clic on the last to select another item, data on the second control disappears. I don't know why.
Are you calling UpdateData somewhere.
|
|
|
|
|
i downloaded an article's files on this link: http://www.codeproject.com/bitmap/ImageProcessing.asp
when i run the executable version of project no error appears
but when i compile the source files this error appears .
-- fatal error C1083: Cannot open include file: 'gdiplus.h': No such file or directory
-- cannot open file '.\Debug\CimageProcess.sbr': No such file or directory
i have this problem in other programs that using GDI+
thanks for help
erfan
-- modified at 7:49 Sunday 17th September, 2006
|
|
|
|
|
Do you have this file in your system?
|
|
|
|
|
gdiplus.h?
where this file must be located?
|
|
|
|
|