|
Please help me write a simple Dialog base that can load an image to a frame
|
|
|
|
|
You can use LoadImage or CImage class for load an image
|
|
|
|
|
Hi guys,
I create a popup context menu dynamically and this menu can contain many sub menus. I use InsertMenu function like this:
Menu.InsertMenu(i,MF_BYPOSITION,ID_FAV_BASE+i,element.strQuickName);
the problem is that the created menu is disabled, I want to handle the message in the OnCommand() handler, but when I call TrackPopupMenu() the added menu items are just disabled and I dont know how to enable them.
Thanks
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
See CMenu::EnableMenuItem()
In MFC you can use the command enablers in the parent window as well...
See ON_UPDATE_COMMAND_UI, ON_UPDATE_COMMAND_UI_RANGE, etc.
|
|
|
|
|
No, it is not. The menus were disabled by the MFC framework because the have no message handlers for their associated IDs.
The strange thing is that I create the same menu Items with the same IDs twice, once as a menu attached to the main window, and once as a context menu, those that are attatched to the main window work flawlessly, but those that are used as context menu are always disabled!!!
Any idea?
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Right. Like I stated, use command enablers in the window the menu is "attached" to.
Mark
|
|
|
|
|
Is EnableMenuItem helpfuls?
|
|
|
|
|
No, it is not. The menus were disabled by the MFC framework because they have no message handlers for their associated IDs.
The strange thing is that I create the same menu Items with the same IDs twice, once as a menu attached to the main window, and another time as a context menu, those that are attatched to the main window work flawlessly, but those that are used as context menu are always disabled!!!
Any idea?
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
void APIENTRY omfg_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
{
if (MODELS_1)
{
show_damn_modelz();
}
if (MODELS_2)
{
show_damn_modelz();
}
if (MODELS_3)
{
show_damn_modelz();
}
if (MODELS_4)
{
show_damn_modelz();
}
(glDrawElements)(mode, count, type, indices);
}
/////////in opengl.h i have this
#pragma comment(lib,"OpenGL32.lib")
#pragma comment(lib,"GLu32.lib")
#pragma comment(lib,"GLaux.lib")
#include
#include
#include
void APIENTRY omfg_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
//////// in dll main
bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
hTtnDll = hDll;
DisableThreadLibraryCalls(hDll);
sycoreReDirectFunction("kernel32.dll", "GetProcAddress", (DWORD)&pGetProcAddress);
return TRUE;
}
return FALSE;
}
and this is how i wanna detour it
DETOUR_TRAMPOLINE(void WINAPI glDrawElements_Trampoline(GLenum, GLsizei, GLenum, const GLvoid *indices), glDrawElements);
void WINAPI glDrawElements_Detour(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
{
// ur code
glDrawElements_Trampoline(mode, count, type, indices);
}
//////////////////////
bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
DetourFunctionWithTrampoline((PBYTE)glDrawElements_Trampoline,(PBYTE)glDrawElements_Detour);
hTtnDll = hDll;
DisableThreadLibraryCalls(hDll);
sycoreReDirectFunction("kernel32.dll", "GetProcAddress", (DWORD)&pGetProcAddress);
return TRUE;
}
return FALSE;
}
but i get errors and i dont know what should i do with the void APIENTRY functions ? please anyone could help me ?
|
|
|
|
|
|
See here[^] and here[^]
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
When I saw first link on status bar I guess its acquainted both of them are nice
|
|
|
|
|
Hi all,
My application is an MDI application
I have an "open" button in one dialog box , which upon click, opens up a child window . But one i close the child window , i need to close the dialog also . I know that i should handle within the CChildFrame::OnClose() function,but i dont't know how to get the dialog handle and close it.
I have tried creating
CMydialog *dlg in the CChildFrame class
and invoking
dlg->ShowWindow(SW_CLOSE), but the dialog is not closing
Could you please tell me how to overcome this problem
|
|
|
|
|
Try dlg->DestroyWindow() instead.
You also have to delete dlg at some point unless you've taken the steps to make the modeless
dialog self deleting.
Mark
|
|
|
|
|
(Okie i have many a times heard that theres no such thing as a stupid question, so here goes)
Suppose the wav recorder api stores the sampled data over two characters. How do i read that sample into (one) float data type ???
|
|
|
|
|
Why do you want to use a float? if you want to store two chars into something, you can very well use a WORD. can't you? chars (ASCII) is 8 bits long, which is a BYTE. Two bytes can be placed inside a WORD. So you may consider this:
<br />
char c1='a';<br />
char c2='b';<br />
WORD w1,w2;<br />
<br />
w1=c1<<8;<br />
w2 = w1|c2;<br />
:Gong: 歡迎光臨 吐 西批 :Gong:
|
|
|
|
|
The two byte sample will be used for various mathematic manipulations so we need precision.
Could you also explain how the above code works ???
Thanks..
|
|
|
|
|
What precision values are you storing inside a 'char' ?? I dont understand you. Can you give me some sample data?
hey btw, the << , | thing, let me explain you.
<br />
00000001 - char1<br />
00000010 - char2<br />
Now,
A word is about 16 bits.
so A Word(w1)->00000000 00000000
push the char1 to the upper 8 bits
<br />
w1=char1<<8;<br />
now,
<br />
w1= 00000001 00000000<br />
Now, OR the char2 value
<br />
w1|char2;<br />
00000001 0000000<br />
00000000 0000010<br />
----------------<br />
00000001 0000010<br />
----------------<br />
Now you have the two values inside w1.
:Gong: 歡迎光臨 吐 西批 :Gong:
|
|
|
|
|
(I am not using it right now but) the wav recording API has an option for storing each sample's amplitude in either one byte or two byte. Now these amplitudes are to be mathematically manipulated several times later on. So if we do these operations on just 2 byte "data container" then i guess we'll loose lots of info.... so we need to convert the two byte samples into float data type. (Or maybe i'am not geeting things )
Anyways thanks for the help ......
|
|
|
|
|
You have any documentation online for that?
:Gong: 歡迎光臨 吐 西批 :Gong:
|
|
|
|
|
Are there any GDI guru's out there who could possibly help me out a little? I'm trying to reduce the amount of drawing required within my skinned window by only drawing to invalid regions. The trouble is, GetUpdateRegion() always returns a RECT for the entire window. When resizing this is simply not true, there are a few moved/resized controls and the covered/uncovered edge of the window, but for the most part the window contents remain the same.
The window is created without the CS_HREDRAW and CS_VREDRAW and the only time I call InvalidateRect() or InvalidateRgn() is when the window and child windows are first created. I can't understand why I'm being forced to redraw the whole window when it's not required.
|
|
|
|
|
I have never used GetUpdateRgn(), I always use GetClipBox() for this purpose.
That being said, the update region is going to be the XORed total of all the individual update regions in the window, so if you have a small region to be updated at the top left corner of the window and another small one at the bottom right the total XORed region will be the entire window.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello,
I start to learn Visual C++ .NET.
The first program I made (by a book)(MFC program) show me an error message:
" The NULL device is missing from your system. We are unable to launch a build. Project: error PRJ0015 "
This error occur when I want to build my project.
I tried to restart my computer and to re-install VS 2005, but the error continu.
I couldn'y find a practical advice in MSDN.
Please tell me what to do to fix this problem,
Reuven
|
|
|
|
|
According to this[^] link in MSDN either your computer has insufficient resources (not enough RAM etc.) to complete the task at hand or your user priviledges are set too low.
First thing to check is your user priviledges. If that does not help then make sure your PC meets the minimum requirements for VS2005.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
My computer is meets the MSDN minimum requirements.
About check user privilegs - please tell me how to do it, so I can check.
Thank you very much for answer,
Reuven
|
|
|
|