|
Hi everyone,
I have a main window with a gradient background onto which client area I output text using DrawTextEx. The background of the rectangle of the drawtext function is set to transparent. I invalidate this rectangle everytime I change the text so that the new text will be visible on the gradient background. This works fine for a while and then suddenly windows seems to stop painting the window all together ....? The text still continiues to be outputed , but on a white rectangle background now. The window does not seem to repaint either. I am using straight WIN32 api and simple message handling.
Anybody have any ideas ? This is driving up the walls... help will be much appreciated.
Carpe Deum
|
|
|
|
|
Perhaps you're not freeing resources (pens, brushes) you use in your painting code? That could lead to resource exhaustion. Try adding VERIFY s to your code to verify correct operation and see if they fail.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I write the code which is given below that is getting ram and hard disk capacity from user than saving it in a file and than displaying the file. after that i jst want to display all the records entered by the user and also display the total number of computers whose records were entered by the user. plz hlp me what should i do. code is below:
//Header Files
#include <iostream.h>//header file for input output streams
#include <fstream.h>// Header for file I/O
#include <conio.h>//header file for console input output
using namespace std;
//computerspec structurre
struct computerspec {
int ram;
int hdisk;
}compuspec;
int main()
{//start main
char ch;
ofstream out("computerspec.txt");//creating file name
out<<"RAM"<<"\t"<<"Hard disk"<<endl;
do=""
="" {="" start="" of="" while="" loop
="" prompt="" the="" user="" to="" enter="" ram="" capacity
="" cout<<"enter="" capacity"<<endl;
="" cin="">>compuspec.ram;
//for new line
cout<<endl;
prompt="" the="" user="" to="" enter="" hard="" disk="" capacity
="" cout<<"enter="" capacity"<<endl;
="" cin="">>compuspec.hdisk;
//for new line
cout<
|
|
|
|
|
|
While it is not hurting anything, why do you have the computerspec structure if you are using the member variables individually? I would think you'd want something like:
struct computerspec
{
int compnum;
int ram;
int hdisk;
};
void main( void )
{
computerspec compuspec;
compuspec.compnum = 1;
compuspec.ram = 1024;
compuspec.hdisk = 80;
out << compuspec;
compuspec.compnum = 2;
compuspec.ram = 4096;
compuspec.hdisk = 40;
out << compuspec;
...
compuspec.compnum = -1;
compuspec.ram = 0;
compuspec.hdisk = 0;
out << compuspec;
out.close();
...
do
{
in << compuspec;
} while (compuspec.compnum != -1);
} Note that this is untested and may not be syntactically correct but I am just trying to give you an idea.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Still i m not getting what i want to know!!! plz smebody hlp!!
|
|
|
|
|
rose aashii wrote:
Still i m not getting what i want to know!!!
What is it that you are still wanting to know?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am farily new to c++ and have been trying to compile something but it is giving errors about converting the two different types of char. Is there anyway that I can actually convert the char to a char* or have I got completley the wrong idea?
|
|
|
|
|
I think that you are off base.... post the code that you are having a problem with so we can help you better.
Artificial intelligence is no match for natural
stupidity.
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
CIni ini;
ini.SetPathName(_T("D:\\Programs\\Microsoft Visual Studio\\MyProjects\\Prog12\\Debug\\IniDemo.ini"));
char test = ini.GetChar(_T("History"), _T("Input"), TCHAR("NoneSet"));
char* Program = "";
char* Paramaters = "";
char* workingDirectory = "";
// Now just use ShellExecute to run it
ShellExecute( NULL, "open", Program, Paramaters, workingDirectory, SW_SHOW );
The char test is the one that I need to be char* otherwise the ShellExecute will not work properly. I dont really understand all of that code yet which is probably why I cant do it correctly.
|
|
|
|
|
talkster5 wrote:
The char test is the one that I need
Since test is not being used, why do you need it at all?
What does CIni::GetChar() return? More importantly, what is the third parameter supposed to be? I'm not sure why the class differentiates between getting a char vs. getting a string , but in any case, you need to change your code to the following in order to pacify the compiler:
char test = ini.GetChar(_T("History"), _T("Input"), ' '); Why are you mixing _T() and TCHAR() ? That in itself doesn't hurt anything but it does make your code hard to read.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The information for the shellexecute is going to be stored in an ini file so at the moment I am just testing getting the information from an ini file which is why the char test is there but now I need it to be a char* so I can actually use it in the shellexecute as when I compile it says shellexecute can only use char* and not char.
|
|
|
|
|
You cannot use the GetChar() method to retrieve a char* value. Which parameter of ShellExecute() is in error?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The Program, Paramaters and working directory all do not work if its just char.
|
|
|
|
|
Right. ShellExecute() does not use any char parameters. Without seeing the code that is in error, I can't provide anything useful.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
What do you mean the code that is in error? The code I posted above is the only code I have in the program at the moment. Do you want the actual error message from the compiler?
|
|
|
|
|
talkster5 wrote:
Do you want the actual error message from the compiler?
That would help tell us what exactly the error you are getting is.
|
|
|
|
|
There is nothing wrong with the call to ShellExecute() . The error, as I've already pointed out, is in the call to GetChar() . Correct that and you'll be on your way.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yes, but what over way can I get a char* from an ini file as that was the only function that I thought would work seen as I am storing characters in my ini file.
|
|
|
|
|
OK, then try GetPrivateProfileString
This returns a string from the ini file. I hope this will solve ur problem.
"I would luv to change the world, but they wont give me the source code"
My Articles
|
|
|
|
|
Unless you have a compelling reason to use the CIni class, why not simplify things and use GetPrivateProfileString() instead? Something like:
char szBuffer[128];
GetPrivateProfileString("History", "Input", "", szBuffer, sizeof(szBuffer),
"D:\\Programs\\Microsoft Visual Studio\\MyProjects\\Prog12\\Debug\\IniDemo.ini");
...
ShellExecute(...);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for the code David. In my ShellExecute where I want the value to go to I put szBuffer or what do I put please?
|
|
|
|
|
talkster5 wrote:
In my ShellExecute where I want the value to go to I put szBuffer or what do I put please?
I do not know enough about the problem to answer this. For example, what does the .ini file look like?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
My ini is like this but I have changed it from History and Input to the correct settings when getting the information.
[Settings]
Path=notepad.exe
Paramaters=
WorkingDirectory=
So in the ShellExecute I would want to get all 3 values and put them into the ShellExecute so it can run it.
|
|
|
|
|
char szPath[_MAX_PATH],
szParameters[_MAX_PATH],
szWorkingDir[_MAX_PATH];
GetPrivateProfileString("Settings", "Path", "", szPath, sizeof(szPath),
"D:\\Programs\\Microsoft Visual Studio\\MyProjects\\Prog12\\Debug\\IniDemo.ini");
GetPrivateProfileString("Settings", "Parameters", "", szParameters, sizeof(szParameters),
"D:\\Programs\\Microsoft Visual Studio\\MyProjects\\Prog12\\Debug\\IniDemo.ini");
GetPrivateProfileString("Settings", "WorkingDirectory", "", szWorkingDir, sizeof(szWorkingDir),
"D:\\Programs\\Microsoft Visual Studio\\MyProjects\\Prog12\\Debug\\IniDemo.ini");
ShellExecute(NULL, "open", szPath, szParameters, szWorkingDir, SW_SHOW);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|