|
I found out why there is an error
It is nothing to do with chart..
Printout method get error because there are some hidden sheet
to solve the problem, I only have to set the sheet to visible.
sheet.SetVisible(1);
|
|
|
|
|
|
Hi Mike.. I did changed to VARIANT_BOOL field.
Thank you.
|
|
|
|
|
I want to prevent computer from being shut,my codes as below:
BOOL CMyTestDlg::OnQueryEndSession()
{
return FALSE;
}
BOOL CMyTestDlg::OnInitDialog()
{
if(SetProcessShutdownParameters(0x4ff,SHUTDOWN_NORETRY)==0)
{
MessageBox("SetProcessShutdownParameters Failure");
return ;
}
}
void CMyTestDlg::OnButtonOk()
{
ShutDownCodes();
}
MSDN say program can prevent computer from being shut by enhance the program level by SetProcessShutdownParameters,but After I clicked the OkButton the Computer is shut down,what should I do?
|
|
|
|
|
msdn says this about SetProcessShutdownParameters()...
"This function sets a shutdown order for a process relative to the other processes in the system."
Its does not say that it allows a process to terminate the shut down process.
I think this fucntion AbortSystemShutdown() is what you are looking for but Im not sure
|
|
|
|
|
WM_QUERYENDSESSION
The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls the ExitWindows function. If any application returns zero, the session is not ended. ////The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
/////
After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
A window receives this message through its WindowProc function.
WM_QUERYENDSESSION is sent to program from the high Shutdown priority to low
|
|
|
|
|
Hi everyone, i am getting angry while trying to insert richedit control, to my small dialogbox application.
Well, everything works fine to the moment i put the richedit control on my dialogbox, then
application starts and exits in some of 1ms.
My program is basically a dialogbox application, i wanted to implement a nicee richedit control but when i only put her inside the dialogbox, the app does not work!
Any ideas?
ps1. hwnd= DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), 0, MainDlgProc);
that's how i init my main program dialog box
ps2. all other controls beside richedit - work fine, i'm having a big problem.
|
|
|
|
|
If you are using a rich edit control in a dialog box (regardless whether your application is SDI, MDI, or dialog-based), you must call AfxInitRichEdit once before the dialog box is displayed. A typical place to call this function is in your program’s InitInstance member function. You do not need to call it for each time you display the dialog box, only the first time.
e.g.
BOOL CMyApp::InitInstance()
{
AfxEnableControlContainer();
AfxInitRichEdit();
………………………….
}
Naveed Shoaib
|
|
|
|
|
Hello,
what 'bout not MFC app ? I'm writing in pure w32 API, is there any
chancee to run that?
|
|
|
|
|
I need to write a program in visual C++ 6.0 that will read and HTML file and modify contents programmatically. Especially I need to cause the pushbuttons within the HTML file to execute. Can anyone help me with this.
Freeman Taylor
|
|
|
|
|
Reading and modifying HTML is easy if it's XHTML, just read it into an XML document. How do you mean you want the buttons to execute ? You actually want not just to read them, but to run them in a browser programatically ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi,
Yes, guess I wasn't too clear. I have to program a "wrapper" around some existing HTML code. Within the HTML code I want to choose certain selections in the HTML and cause them to execute but keep the HTML code from being visible, so I guess that would be as you say to run them in the browser programatically. I have been reading up on the IDispatch methods from Microsofts web site, but can't seem to make it work.
Thanks for your help
Freeman Taylor
Freeman Taylor
|
|
|
|
|
My aim is to control the backColor of the CStatic that I use in my app. So I derived a class from CStatic . Now The text that gets displayed needs to be according to a Custom font. I am handling the
BOOL CHeadingStatic::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult) <br />
{<br />
if (message != WM_CTLCOLORSTATIC)<br />
{<br />
return CStatic::OnChildNotify(message,wParam,lParam,pLResult);<br />
}<br />
HDC hdcChild = (HDC)wParam; <br />
if(colored)<br />
SetBkColor(hdcChild,RGB(0,120,120));<br />
*pLResult = (LRESULT)(m_brush.GetSafeHandle());<br />
return TRUE;<br />
}
Now I added another public
<br />
void CHeadingStatic::ChangeFont()<br />
{<br />
SetFont(&headingFont);<br />
<br />
} method in this class to change the Font .
So externally I first creating this object and then
doing an
<br />
object.create(......)<br />
object.ChangeFont()
I notice a lot of flickering and it takes a while to come up . Is there a way i can do this during creation ?
Engineering is the effort !
|
|
|
|
|
I'm trying to define a class for vmr9 rendering. Conform to the DX9DSK docs i use the CLSID_VideoMixingRenderer9, but it says is not declared:
"e:\Programming\VC++\VMR9WindowlessRender.cpp(632): error C2065: 'CLSID_VideoMixingRenderer9' : undeclared identifier"
Any ideeas ?
|
|
|
|
|
I have:
(nh-nl + 1) 1247923961
and calloc fails:
v=(double *)calloc((nh-nl+1),sizeof(double));
v is zero.
How do I fix this? Why is this happening?
|
|
|
|
|
I think you are trying to allocate over 2GB of space.
|
|
|
|
|
You're allocating over 8GB of memory. Windows won't let you do this...
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"
|
|
|
|
|
Thanks for the responses. I was really puzzled about that. I wonder what makes calloc fail other than insufficient memory.
Thanks,
sb
|
|
|
|
|
Is there source code that will load a BMP or a JPG file and present that as if it is coming from a web camera so that MSN or Yahoo web cam will believe that it is using a valid web cam? There is a commercial software called VirtulaCamera but I am lookin for source code. Any help is appreciated. Thanks
Watchman
|
|
|
|
|
Looking for anyone with experience developing a decoupled WMI provider - without .net class nor ATL. SDK examples just don't do it, and microsoft forum is no help either.
Hint: It would be a GREAT article for codeproject posting!
tim
|
|
|
|
|
Like in topic.. this question may be silly, but I'm new programmer so be gentle (plz). What should I do if I want to "refresh" the value of variables in DOS version? I'll include here a part of my source code. Treat this as a sample of my problem.
for( ;; )
{
int result = GetKeyState(VK_SHIFT);
if(retult == 1)
{
..code..
}
}</code>
This code will slow down every comp - I think. I need a solution of that problem. Thanks in advance.
_________<br />
I'm made in C++... and I'm proud of it!
|
|
|
|
|
SetTimer(NULL,NULL,1,NULL);
case WM_TIMER:
int result = GetKeyState(VK_SHIFT);
if(retult == 1)
{
..code..
}
break;
or
you can use your code but put this extra
for( ;; )
{
int result = GetKeyState(VK_SHIFT);
if(retult == 1)
{
..code..
}
Sleep(1);
}
gabby
|
|
|
|
|
although for(;;) is valid i suggest you use while(TRUE) instead (the for loop wasnt really intended for infinite loops)
i doubt that it is your infinite loop that is slowing down the computer, try to quiting some process first
i have run many instances of programs that do more than your code seems to be doing, and it didnt affect the speed.
|
|
|
|
|
Before going down this path, see if there is a way to register to recive key pressed events that gives you what you need. What you are doing is called polling, and it ALWAYS slows a computer down. To get around it computers have interupts of various sorts so that you can be told that something happened.
So you have something like:
while(someWaitForKeyEvent()) {
if(GetKeyState(VK_SHIFT) == 1)
..code..
Assuming you have to poll I'd do it something like:
while (1 != (result = GetKeyState(VK_SHIFT)) {
sleep(1); // wait one second before polling again
}
..code..
lookup sleep (including other forms of it like BSleep), see if there is one that will yield the rest of your CPU cycles to other tasks. I suspect sleep(1) is too long so you will want, so find something that does the same thing, but for less time.
Basicly what is happening is you can run GetKeyState several hundred times in your timeslot, but you can call GetKeyState a lot faster than a human could press the keyboard. (look up debouncing sometime, it is taken care of for you, but it will help you see what is going on) So you are looking for a way to tell the computer "I won't be able to do anything for a while, do something else"
One last point: instead of if(result == 1) you should use a constant or an enumeration so you can do if(result == KEY_DOWN) this makes it clearer to readers what you mean. As you wrote you code I'm not sure what it means, while KEY_DOWN tells me something. (There might even be defined constants in a headerfile someplace.
When I first saw your code I was thinking of key as in encryption key, and figured you were waiting on a thread to generate the key! It took me a minute to realise that it was a windows function and then I had to look it up to see what it did)
|
|
|
|
|
I'm having trouble with something that my professor assigned. He's out of town at the moment and hasn't answered any of my emails and the text book doesn't explain how to do this very well. It is an encryption/decryption program. The output should be like this:
Original string is: this is a secret!
Encrypted string is: uijt!jt!b!tfdsfu"
Decrypted string is: this is a secret!
Basically this program turns a character into the next letter of the alphabet. For example t becomes u, h becomes i,spaces become exclamation points, etc. The objective of this lab is to use pointer notation to make the program do this but I don't understand pointers too well. If someone could get me started on this program I'd appreciate it. Here's the template. Where you see /* that's where I have to write lines of code. The part that I'm totally cluless on is the implementation of the functions 'encrypt' and 'decrypt'. Thanks.
#include <iostream>
using std::cout;
using std::endl;
/* Write the prototype for function encrypt */
/* Write the prototype for function decrypt */
int main()
{
// create a string to encrypt
char string[] = "this is a secret!";
cout << "Original string is: " << string << endl;
encrypt( string );
cout << "Encrypted string is: " << string << endl;
decrypt( string );
cout << "Decrypted string is: " << string << endl;
return 0;
} // end main
// encrypt data
void encrypt( char e[] )
{
/* Write implementation for function encrypt */
} // end function encrypt
// decrypt data
void decrypt( char *ePtr )
{
/* Write implementation for function decrypt */
} // end function decrypt
|
|
|
|