|
>wisecrack:
Thank you for answering.
By the way, after posting message I looked into more information.
And I found that "CMenu:CEnableMenuItem" may be right.
My goal is to develop MFC project of dialog base.
For example, here is a goal that when right-clicked over the icon of text file in Explorer,
the item "cut" is glay.
The below is the method.
I created new MFC project of dialog base.
(The project name is "Click".)
And I added below code of "OnRButtonDown" with Class Wizard into "CClickDlg.cpp" file:
===
void CClickDlg::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO:
CMenu *hMenu;
CWnd* cwParent = GetParent();
DWORD dwStyle = cwParent->GetStyle();
hMenu = cwParent->GetSystemMenu(FALSE);
hMenu -> EnableMenuItem(ID_EDIT_CUT, MF_GRAYED);
CDialog::OnRButtonDown(nFlags, point);
}
===
And including "afxres.h" in the first of "CClickDlg.cpp" file, I built "Click.exe" file.
With "Click.exe" executing, I executed "explorer.exe" and I clicked right button
over a certain text file.
But the item "cut" wasn't glay.
Which point of my method is wrong?
If there is another good idea or programming flow, please tell me.
|
|
|
|
|
Many Download Managers allow you to pause and resume your download, some are even able to resume after being disconnected.
Now my question is how do they pick up where they left off? I'm guessing there is some standard information sent in the request as to where the server should start reading from the file.
|
|
|
|
|
Well, it isn't even remotly connected to Visual C++ but what the heck...
If you are talking about FTP download managers the some (most) servers support the REST (restart) command. Check the RFC for more info.
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
|
Yes, I believe it is HTTP 1.1 that supports resumable downloads.
Michael Dunn wrote:
Come quietly or there will be... trouble.
Robocop?
Peace!
-=- James
Tip for inexperienced drivers: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
I need the main window of my program (created by DialogBox() function) to become hidden already on the startup. If I call ::ShowWindow(hWnd,SW_HIDE) when I receive WM_CREATE or WM_INITDIALOG messages, it doesn`t work because these messages are regeived before dialog is shown. So how can I do it? I can not write consele app because I will need to show the window eventually.
|
|
|
|
|
Hide your main window...???
Interesting...you could try using a similar approach to system tray windows. Make a parent window using WS_EX_TOOLWINDOW and have your main window a child of this window.
How do I print my voice mail?
|
|
|
|
|
I am not sure whether this is what u want
http://www.codeproject.com/system/xyntservice.asp
|
|
|
|
|
hi everyone..
I'm working on a project to make a dll that contains some functions...I want to name some functions the same name that some APIs do..
e.g. I want to make my own "FormatMessage" function in my dll...
|
|
|
|
|
Put them in a namespace. It's still a terrible idea.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I actually don't know how to do that could you write a simple function using this way...
|
|
|
|
|
namespace ThisIsAHorribleIdea
{
void MyAPIFunction()
{
}
}
Now you need to call it like this : ThisIsAHorribleIdea::MyhAPIFunction();
And if you don't know what a namespace is, you should buy a beginners book on C++ and read it before you go any further.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi, i'm doing an ansi c program, compiling with gcc. I get a warning that the gets function is dangerous. Everything works fine, but i don't want to get that warning.
char *Comando=0;
Comando=(char*)malloc(150*sizeof(char));
gets(Comando);
I can't (or don't know how to) use scanf as if i type a string with spaces scanf only saves the characters until the first space.
which function could i use apart from gets (and it must be ansi c )?
thanks!
|
|
|
|
|
The problem with gets() is that is doesn't consider the size of the destination buffer. In your case just enter more that 150 characters and PRESTO! Insta-crash(tm). May I recomand fgets() instead?
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
That warning is telling you that it is IMPOSSIBLE to use gets correctly! If your program uses gets I can crash it. Any professor who sees gets in code should automaticly give the student an F!
instead you should use fgets, which can replace your use of gets like this:
fgets(Comando,150,STDIN);
See, it is easy to use fgets, and I can no longer crash your program just be doing something stupid.
|
|
|
|
|
|
There is an extension to the scanf(...) function that allows to scan non-space-delimited strings. I do not know if it is available in GCC's libraries...
It works like this: to scan a string that is terminated by a semicolon, your format specifier would be: %[^;] . For example, if you wanted to scan this string:
C:12345;B:09876
And extract the two numeric values into two strings (12345 and 09876 ), you would write something like:
char caStringBuf1[ 64 + 1 ];<br />
char caStringBuf2[ 64 + 1 ];<br />
<br />
sscanf( "C:12345;B:09876","C:%[^;];B:%s", <br />
caStringBuf1, caStringBuf2 );<br />
caStringBuf1[ 64 ] = '\0';<br />
caStringBuf2[ 64 ] = '\0';
You would want to limit the input test somehow, of course and add some validation code, but that would scan the string correctly.
Peace!
-=- James
Tip for inexperienced drivers: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
I'm using Visual C++.net 2002 with MFC's. Created the project then built it. I changed the Icon after the build with the Icon editor. The problem is now only the about box shows the change. The .exe file and SDI dialog shows the MFC icon. What setting do I change to have my icon take effect?
|
|
|
|
|
An icon can have multiple colour depths and sizes in one .ico file. It sounds to me like you are editting the 32x32 icon, which is displayed in the about box, but not editting the 16x16 icon.
If you view large icons in Explorer, do you see your changed icon for the exe?
|
|
|
|
|
Thanks, did not know that there where different sizes for the Icon. Which each had to be changed. Just thought C++ changed the size for you. LOL. Well that did it and I know have my own crappy but orginal icon in my program. Thanks again.
|
|
|
|
|
Hi,
I am getting WM_CAPTURECHANGED messages with lParam=0 and then my WindowProc stops getting messages (because my focus has disappeared). How is this legal? lParam is supposed to contain the HWND of the window that stole focus away from my WindowProc but it is zero which is an illegal value. How do I find out who has taken focus? Is this documented anywhere?
Thank you,
Gili
|
|
|
|
|
Don't know if this is documented somwhere but this sounds like Screen Saver attempt at getting the focus before actually going in Screen Saver mode.
|
|
|
|
|
This is actually what you get when you click on the desktop and drag a rectangle. So, to answer your previous post, it isn't some sort of screensaver... but something is taking the focus away from the desktop. I will keep on looking.
|
|
|
|
|
I think you're getting focus and mouse capture confused. They are not the same thing. To check for a focus change, you'll need to handle WM_KILLFOCUS , not WM_CAPTURECHANGED .
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Sorry, you are right. I believe what is going on is that upon the user clicking and dragging inside the window, WM_CAPTURECHANGED is received indicating that the mouse capture has been released (that's probably what lParam=0 means).
The problem, then, is that WM_MOUSEMOVE messages are being posted on the event-queue but my WindowProc never receives them. I am subclassing some other window. My guess is that the window calls GetMessage(), sees WM_MOUSEMOVE, and handles it internally without passing it on to the WindowProc. This poses a problem for me because I absolutely must subclass WM_MOUSEMOVE. Any ideas?
Gili
|
|
|
|