|
Hi,
Yes that should do it!
|
|
|
|
|
//Looks like you want to do flicker free drawing
//Which is the only reason for doing this
CDC MemDC;
CBitmap bmp;
CClientDC mydc(this);
MemDC.CreateCompatibleDC(&mydc);
bmp.CreateCompatibleBitmap(&mydc,1024,768);
CBitmap* pOldBmp = MemDC.SelectObject(&bmp);
// Draw rectangle
CBrush* pOldBrush = MemDC.SelectObject(&mybrush);
MemDC.Rectangle(myrect);
MemDC.SelectObject(&pOldBrush);
//TODO: Draw other things
//Blit to client DC
mydc.BitBlt(0,0,1024,768,&MemDC,0,0,SRCCOPY);
//Clean up
MemDC.SelectObject(&pOldBmp);
MemDC.DeleteDC();
Doing all of the above when you receive a WM_PAINT message is the slow way, but it works.
Find the article "Do a flicker-free drawing using MFC methods" here at codeproject. I have not read it but it should provide you with your answers.
Trust in the code Luke. Yea right!
|
|
|
|
|
Thank U all for the replies
I got it.
Regards
Satya
|
|
|
|
|
I need to create a new system level environment variable in my MFC code ..Is there any API for it ..
I think putenv() changes only the process level environment varaible .But GetEnv() retrives the system level environment variable !!!!
Help required for the above situation...
|
|
|
|
|
In Win2k/XP, global environment variables come in two flavors: system and user. For lack of a suitable API, you can directly access them via the registry at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment and
HKEY_CURRENT_USER\Environment respectively.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
dear Joaquín M López Muñoz'
Thanks a lot ..
But my doubt is that will the PATH for environment variables be same in all the WIndows OS starting from Windows 98????
If there is a API ,it would be much better ...
|
|
|
|
|
See SetEnvironmentVariable()/GetEnvironmentVariable() in the docs. Win95 and later.
|
|
|
|
|
This is the functin I'm working with:
void CJobQueueSimulatorView::LoadSkills()<br />
{ <br />
<br />
int numItems = m_skills.GetCount();<br />
<br />
for(int k = 0; k < numItems; k++)<br />
{<br />
m_skills.DeleteString(0);<br />
}<br />
<br />
char next[25];<br />
<br />
fstream fin(strCurrType + "_skills.txt", ios::in);<br />
<br />
if(!fin)<br />
{<br />
MessageBox("Could not open skills file!", "File Error", MB_ICONEXCLAMATION);<br />
}<br />
else<br />
while(fin >> next)<br />
m_skills.AddString(next);<br />
<br />
fin.close();<br />
}
What I would like to do is prepend a letter to each line I read from my text file. This would give me an I.D. that I can associate with each "skill". m_skills is a list box control variable. I don't want the letter code to be saved in the text file. I would like it to be assigned as the lines are taken from file and put into the list box. This would prevent users from assigning skills the same "I.D". Also, later when they add skills to the list, it would automatically assign an "I.D" I'm thinking the way to do it is with ASCII but I'm dumb and don't know how to do it. Anyone have a good idea of how to do it? (Sorry for the sloppy formnatting above. Things didn't copy over that well)
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
strcat() example from MSDN:
<br />
<br />
#include <string.h><br />
#include <stdio.h><br />
<br />
void main( void )<br />
{<br />
char string[80];<br />
strcpy( string, "Hello world from " );<br />
strcat( string, "strcpy " );<br />
strcat( string, "and " );<br />
strcat( string, "strcat!" );<br />
printf( "String = %s\n", string );<br />
}
Output:
String = Hello world from strcpy and strcat!
|
|
|
|
|
char next[25];
CString str;
...
while(fin >> next)
{
str = some_unique_identifier + next;
m_skills.AddString(str);
}
|
|
|
|
|
I am using two network cards on a system.
I am using winpcap to send the packet that I receive from one interface and sending it to the other interface the packet does reach the intended destination but the reply(ping request is reached at the destination but reply does not generate) does not appear.
Please If you can help me in the solution of the problem.
Reply me soon
|
|
|
|
|
I am using WinExec("C:\\logfile.txt",SW_SHOW) to open my file in a notepad on pressing a certain button but the file is not opened in the notepad. Infact nothing is happening when I press the button.
I am using the same code of line WinExec("Notepad.exe,SW_SHOW") to open the notepad and it is working properly there. Plz give me its solution, by just giving the path of our file, it could open in a notepad.
thanx
Reply me soon
|
|
|
|
|
summo wrote:
I am using WinExec("C:\\logfile.txt",SW_SHOW) to open my file in a notepad
According to MSDN, the first parameter of WinExec is "Pointer to a null-terminated character string that contains the command line (file name plus optional parameters) for the application to be executed". In other words, first parameter must include name of program you want to execute. WinExec is not shell-oriented, i.e., it does not "associate" file types with applications. What you want is ShellExecute, which is shell-oriented:
ShellExecute(NULL, "open", "C:\\logfile.txt", NULL, NULL, SW_SHOW);
Best wishes,
Hans
|
|
|
|
|
Did you try WinExec("Notepad.exe C:\\logfile.txt", SW_SHOW)? WinExec("C:\\logfile.txt", SW_SHOW) tries to execute logfile.txt which is not an executable file.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Thanks Alot Toni78, u r really genious. yest the code is working, now tell me, after writing WinExec("Notepad.exe C:\\logfile.txt",SW_SHOW) i want that the file logfile.txt opened in notepad must be maximized.
thanx
|
|
|
|
|
Well, thank you. Instead of SW_SHOW use SW_SHOWMAXIMIZED.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
How can I convert twips to pixels?
|
|
|
|
|
Try this:
#twips = is width
#pixels = MulDiv(#twips, GetDeviceCaps(hDC, LOGPIXELSX), 1440)
#twips = is height
#pixels = MulDiv(#twips, GetDeviceCaps(hDC, LOGPIXELSY), 1440)
ÿFor the bread of God is he who comes down from heaven and gives life to the world. - John 6:33
|
|
|
|
|
Thank you so much Ernest. This is what I was looking for. I knew that there were 1440 twips per inch or 567 twips per cm but I just couldn't figure out how to get the number of pixels per inch. Thank you.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
GetDeviceCaps() LOGPIXELSX LOGPIXELSY
for a screen these will usually be hardcoded to 72 dpi as windows has no real knowledge of the physical size of the display
|
|
|
|
|
Hello all
Plz , I search a code of a GUI(MFC) same in this URL : http://www-ic2.univ-mans.fr/~lemeunie/these/node75.html#fig-interface-ami1
(Figure 4.3: Interface de AMI1).
Thanks very much
|
|
|
|
|
So what's your question? By the way, the URL you provided is invalid.
|
|
|
|
|
See plz this picture
http://www-ic2.univ-lemans.fr/~lemeunie/these/img186.gif
I want to creat a same of the GUI (interface grphic ) in this picture.
I Don't Know if can i find this in "The code project"
Thanks for you.
NB: I work with VC++ 6 MFC
|
|
|
|
|
Well, it's a dialog box with the following controls:
a listbox
a static label
an edit box
four push buttons
|
|
|
|
|
Do you know any code or tutorial in net?
|
|
|
|