|
Search codeproject for "Easily change screen resolution".
Trust in the code Luke. Yea right!
|
|
|
|
|
I have to change the standard MFC icon located in the top left portion of the main window to another icon.
|
|
|
|
|
Simply provide a new .ICO file in the res folder.
|
|
|
|
|
I have a file which is a type Icon, I have placed that in the res folder.
Does it have to be .ICO?
Once I place the file in the res folder, how do I actually import it in my program so it replaces the IDR_MAINFRAME image of MFC?
|
|
|
|
|
Note the name of the current IDR_MAINFRAME icon (e.g., myproject.ico). Delete that file. Rename your .ICO file to the name of the old (MFC) file. Recompile.
|
|
|
|
|
Hi,
Here is the way to change the icon programmatically,
CSomeApp::InitInstance()
{
...
...
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
HICON hIcon = LoadIcon(IDR_CHANGED);
pMainFrame->SetIcon(hIcon, TRUE);
pMainFrame->SetIcon(hIcon, FALSE);
}
regards
~Hari~
|
|
|
|
|
yeah you can use that.
I always use the constructor of the dialog:
CDlgDialog::CDlgDialog(CWnd* pParent /*=NULL*/)
: CDialog(CDlgDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CXyKeyGeneraterDlg)
//}}AFX_DATA_INIT
m_hIcon = AfxGetApp()->LoadIcon(IDR_ICONNAME);
}
just change the IDR_ICONNAME to your ico's inserted name.
but it's all the same actually.
Btw, do you know any websites where i can download seperate .ico files like the 'key' security icon?
Greetings
Jens
|
|
|
|
|
No, I don't know any websites,
let me know if you find any.
Azi.
|
|
|
|
|
Hi!
I am new to socket programming. When I open a socket to a TCP server, is there a way to detect data whenever it's coming back?
Please help!
Thanks
|
|
|
|
|
What I/O model does the server utilize? Under a non-blocking I/O model, the server either monitors the socket. Some I/O models such as WSAAsyncSelect utilizes a process message queue to update a thread on socket activity.
Kuphryn
|
|
|
|
|
Look into the select() api call. You can detect a pending receive either blocking or unblocking in a loop based on the timeout value you specify.
|
|
|
|
|
Somebody can help me?
I need to declare a pointer to a class prior to defining the class.
I'm programming in Visual C++ 6, the code is something like this:
// header file A.h
class A : public CObject
{
....
}
// header file B.h
class __single_inheritance MyClass;
class B : public A
{
MyClass * m_pMyClass; // error C2027
.....
}
// header file C.h
class C : public Object
{
B * m_pBdata;
}
// header file MyClass.h
class MyClass : public C
{
.....
}
But, it doesn`t work, when I compile the code, Visual c++ give me the next error:
C2027: use of undefined type MyClass
Please, I need help,
Thanks a lot.
|
|
|
|
|
Just do a forward declaration:
class MyClass;
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
I didn't find anything necessarily wrong with your code except for the inclusion of a few missing .H files.
At the top of B.H, you need to include A.H, since class B is derived from class A.
At the top of MYCLASS.H, you need to include C.H, since class MyClass is derived from class C.
That's all I had to do to your code to clean up the compiler errors.
Make sense?
|
|
|
|
|
I have a Browser Helper dll that disables the context menu in IE and also several of the Accelerator and 'F' keys. I use a keyboard hook to trap for the keys and that includes F1 (Help).
The F1 trap doesn't work. The Windows Help comes up anyway. Is there a way to disable the help from coming up?
I guess I can look for the WM_HELP message, but have not done this type of thing in a dll before. Anyone have any suggestion please? Thank you very much.
AYousif
|
|
|
|
|
Try two things:
set the hook as a low level hook: WH_KEYBOARD_LL / LPKBDLLHOOKSTRUCT (find more in MSDN).
and if this don't work, then set it as a SYSTEMWIDE HOOK: hHookKeyboard = SetWindowsHookEx(WH_KEYBOARD_LL, HookKeyboardLL, hInst, NULL);
Hope this helps.
|
|
|
|
|
Hi Joan,
Well, I found the answer by chance and it was quite simple. I didn't realize a DISPID_... existed for this event. I updated my Invoke method to include:
<br />
case DISPID_HTMLELEMENTEVENTS_ONHELP:<br />
pvarResult->vt = VT_BOOL;<br />
pvarResult->boolVal = FALSE;<br />
break;<br />
This did the trick. BTW, I had tried the Low Level hook but it never got called. I'll keep the SYSTEMWIDE HOOK suggestion for future needs. Thanks.
AYousif
|
|
|
|
|
Is there any way to programmatically disable Visual Styles for an application so that it looks normal under XP like it would in previous versions of the OS?
|
|
|
|
|
What's the easiest way to read the width and height of a png file using C++ it’s the ONLY image type I'm going to read so massive image libraries are a waste of space in my program. Any ideas?
Cheers
RW
|
|
|
|
|
|
I'm having trouble getting understanding the header information. It doesnt seem very clear to me however regardless of that, how can i change my four bits stored in 4 indexes of an array into a recognisable number? I'm not much good with bit shifting
|
|
|
|
|
Do you have a code snippet of what you are trying to do?
|
|
|
|
|
Sure.
The basic idea here is that its going to create a button for a menu in directx. Its gotta find the size of the button image before it can create the panel to texture the png file onto [hence the panel and graphic are the same size] All I need for this is the width and height. DirectX can do the rest.
<br />
std::ifstream data_file;<br />
data_file.open("filename.png", std::ios::in | std::ios::binary);<br />
<br />
char signature[8];<br />
<br />
char width[4];<br />
char height[4];<br />
<br />
data_file.read(signature,8);
<br />
<br />
data_file.read(width,4);<br />
data_file.read(height,4);<br />
<br />
int texWidth = (int) ((width[0] << 32)+(width[1] << 16)+(width[2] << 8)+width[3]);<br />
data_file.close();
|
|
|
|
|
OK heres a better one since I just solved one problem and got another...
<br />
std::ifstream data_file;<br />
data_file.open("filename.png", std::ios::in | std::ios::binary);<br />
<br />
char signature[16];<br />
char width[4];<br />
char height[4];<br />
<br />
data_file.read(signature,16);<br />
<br />
data_file.read(width,4);<br />
data_file.read(height,4);<br />
<br />
int texWidth = 0;<br />
for(int i=0; i<4; ++i){<br />
texWidth <<= 8;<br />
texWidth += width[i];<br />
}<br />
<br />
<br />
data_file.close();<br />
Now it says the width of my image is -56!?
|
|
|
|
|
Real World wrote:
texWidth <<= 8;
texWidth += width[i];
Did you mean to use both of these or just one of them?
|
|
|
|