|
If you need to save it when ONE key is pressed, yes, you must use the switch (nChar) case to check if the key pressed is the one you need. Then use your code as you have it (if it works good)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
|
Sorry if you thought I was laughing or pissing you off. I will help you as long as I can.
The first thing. Your programm is writting the output to a file continuosly because you have all the code in the loop of messages in the OnPaint. So it will be executed every time the window updates.
I don't know the structure of the OnKeyDown programming all as you make, but using win32 under VC++ the function is:
afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
You can switch the UINT nChar and look which is the key pressed (VK_RETURN, VK_ESC, VK_F1, VK_DELETE...) and call the function you want or execute the code you need.
I'm not sure if you can check (according to your code) the WM_KEYDOWN and take the parameters directly there. But you can try to emulate the function of MFC and when it is called then make the other switch to select the key.
Sorry if it doesn't help you very much. But at least you have an idea to continue looking for the solution.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
what is difference between win32 application and win32 console application.
Thanks&Regards
srinivasa phani kiran konakanchi
|
|
|
|
|
In a normal win32 application, the subsystem is windows where as in a win32 console application, the subsystem is Console.
create a project of type win32 console application and a win32 normal applications. Take the link tab in the project setting. In "Project option" edit box in that tab, look for the argument "subsystem".
It will be like /subsystem:windows for normal windows application and /subsystem:CONSOLE for console application.
for more details check MSDN[^]
|
|
|
|
|
Another difference is Win32 is more GUI (Grafic User Interface) oriented as the console (old ms-dos programms), altough it is possible to draw and so on. But both of win32 have Win-APIs support.
Note: I can be wrong and need a good explanation too :P But this is what I (at least now) think/know
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Dear all,
I design a chart view to show like in the link below:
http://www.photoupload.org/image/3798.jpeg
My solution is used an array that hold all points and used MoveTo() and LineTo() funtions to draw.
But I need line is more smooth than now and I want to ask about solution to do
I try to study http://www.codeproject.com/gdi/CTGraphics.asp but I didn't understand much!
Thanks
|
|
|
|
|
You can also use GDI+ to perform anti-aliasing.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
To draw the line in the screen you need at least one pixel, other thing is the meaning in size of that pixel (according to the MAPMODE).
Take a look with CreatePen and similars, you can configure the width, and selecting the object in the DC, you will use the configuration you need/want
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
hi, I am using the fillowing code to open the file .
but dialog box could not appear .tell me where is problem
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner =(HWND)NULL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn)==TRUE)
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,0, (LPSECURITY_ATTRIBUTES) NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL);
MessageBox(NULL,TEXT("Press load Button"),TEXT("DEBUG"),NULL);
Trioum
|
|
|
|
|
Whats result when run this code?
OPENFILENAME ofn;
char szFile[260];
HWND hwnd;
HANDLE hf;
ZeroMemory(&ofn, sizeof(ofn ));
ofn.lStructSize = sizeof(ofn);;
ofn.hwndOwner =m_hWnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn)==TRUE)
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,0, (LPSECURITY_ATTRIBUTES) NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL);
|
|
|
|
|
thanks I have done it
Trioum
|
|
|
|
|
You're welcome.
|
|
|
|
|
Hello,
I am creating an outline font as below, and use it with PrintOutlineString, when i use these functions without DIB Section (which i use for printing) it works. However, when i use the DIBSection, i cannot display texts.
May be a bit off-topic in this forum, however if anyone used both together and how?
Thanks in advance.
Bekir.
<br />
unsigned int CreateOutlineFont(char *fontName, int fontSize, float depth)<br />
{<br />
HFONT hFont;
unsigned int base;<br />
<br />
base = glGenLists(256);
<br />
if (stricmp(fontName, "symbol") == 0)<br />
{<br />
hFont = CreateFont(fontSize, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, SYMBOL_CHARSET, <br />
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,<br />
FF_DONTCARE | DEFAULT_PITCH, fontName);<br />
}<br />
else<br />
{<br />
hFont = CreateFont(fontSize, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, <br />
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,<br />
FF_DONTCARE | DEFAULT_PITCH, fontName);<br />
}<br />
<br />
if (!hFont)<br />
return 0;<br />
<br />
SelectObject((*m_dib.GetDC()), hFont);<br />
wglUseFontOutlines((*m_dib.GetDC()), 0, 255, base, 0.0f, depth, WGL_FONT_POLYGONS, gmf);<br />
<br />
<br />
<br />
<br />
<br />
return base;<br />
}<br />
<br />
<br />
void PrintOutlineString(double x, double y, char *str)<br />
{<br />
float length = 0;<br />
<br />
if ((str == NULL))<br />
return;<br />
<br />
for (unsigned int loop=0;loop<(strlen(str));loop++)
{<br />
length+=gmf[str[loop]].gmfCellIncX;
}<br />
<br />
glPushMatrix();<br />
glLoadIdentity();<br />
glTranslatef(x,y,0.0f);
<br />
<br />
glPushAttrib(GL_LIST_BIT);<br />
glListBase(listBase);<br />
glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);<br />
glPopAttrib();<br />
<br />
glPopMatrix();<br />
}<br />
<br />
|
|
|
|
|
Anybody..I am a sophmore in college about to take a c++ programming class. I have now experience with programming at all . Can anybody give me a good website or tell me of a good back that will give me a good founddation for learning to program before i start my class in august. anything would help. thnx
|
|
|
|
|
|
Just put "C++ pdf" in google, you will have a lot of matches with a lot of manuals about. Take some start reading them and ask whatever you don't understand. We will help you as much as we can (but explaining, not doing YOUR homeworks :P)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I have a CDialog base aplication and a button and i want to start (DoModal) but is not working for CFormView !? How can i start a CFormView ??from a CButton !
Bravoone
|
|
|
|
|
CFormView-based (SDI/MDI) and dialog-based refer to the architecture of the app - an app can be one or the other, but not both. You can display a dialog from a CFormView-based app, but you can't display a CFormView from a dialog-based app. If you had a separate CFormView-based app, then of course you could start it from a dialog-based app - is that what you want to do?
|
|
|
|
|
I have a CDialog base aplication and a dialog CFormView base in the same project from CDialog i want to start CFormView HOW ?
Bravoone
|
|
|
|
|
I have explained how to open a CFormView from a MDI, search in forum posts with autor (Nelek) and keywords (Child Window). Part of the code will be usefull. But you will have problems with some parts because you don't have Doc/View relationship. But at least you have an idea about how it should be made.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Bravoone_2006 wrote: I have a CDialog base aplication and a dialog CFormView base in the same project from CDialog i want to start CFormView HOW ?
It sounds as though you want to start one application from within another. Correct? If so, check out CreateProcess() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am having a menu call test and execute..
test is having test1 and test2 as menuitem...
execute is having execute1 and execute2 as menuitem...
i have used the below code to disable test2, execute1..
void CMainFrame::OnUpdateTestTest2(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(FALSE);
}
void CMainFrame::OnUpdateExecuteExecute1(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(FALSE);
}
Now my question is....
i). when i click test1, i want to enable execute1 and test2..
how to do this...
can anyone help me...
Chitra
|
|
|
|
|
You can use of EnableMenuItem for enable/disable or gray a menu item.
|
|
|
|
|
hello again.
friends.. is anybody here can give a link of sample code of
unix to windows client server application.
setup like this:
client = Windows
server = Unix
thanks in advance.
******************************
to know
everything
is to know
yourself...
|
|
|
|
|