|
Can you be more specific.
|
|
|
|
|
Sure, I want to change de code of the program that i got here, the program is about a Neural Network that recognize patterns based on the number of dots, that you draw in the screen so i want to change that and i want to use numbers as inputs and not the dots
|
|
|
|
|
I have a program that I have written in Visual C++ 6.0 that using the textout command for print to the screen. When I initially send text to the screen everything prints. Later I use textout to update the screen but only part of the update is printed or none of it at all.
If I minimize and then maximize my box then all the text that was sent to the screen is printed and everything is at it should be. What am I doing wrong or do I need to do in order to get the screen updated without the minimize and maximize?
|
|
|
|
|
Without seeing your code it's hard to say. There could be a number of things going wrong, failing to invalidate the rect, drawing in the wrong place, drawing out of order, handle leaks....
|
|
|
|
|
This is routine that I call to initially paint the screen and then to update the screen.
int PaintScrn ()
{
pdash_Line = dash_Line;
memset(pdash_Line,'-',300);
//--------- Line 1 ----------------
TextOut(hdc,Col_1,Line_1,"Code Directory",strlen("Code Directory"));
TextOut(hdc,Col_2,Line_1,":",1);
if(strlen(code_dir) == 0)
{
TextOut(hdc,Col_3,Line_1,home_dir,strlen(home_dir));
}
else
{
TextOut(hdc,Col_3,Line_1,code_dir,strlen(code_dir));
}
//--------- Line 2 ----------------
TextOut(hdc,Col_1,Line_2,"OVL File :",12);
TextOut(hdc,Col_2,Line_2,":",1);
if(strlen(overlay1_name)>0)
{
TextOut(hdc,Col_3,Line_2,overlay1_name,strlen(overlay1_name));
}
//--------- Line 3 ----------------
if(strlen(overlay2_name)>0)
{
TextOut(hdc,Col_3,Line_3,overlay2_name,strlen(overlay2_name));
}
//--------- Line 4 ----------------
TextOut(hdc,Col_1,Line_4,"APP File :",9);
TextOut(hdc,Col_2,Line_4,":",1);
if(strlen(app_name)>0)
{
TextOut(hdc,Col_3,Line_4,app_name,strlen(app_name));
}
//--------- Line 5 ----------------
TextOut(hdc,Col_1,Line_5,"SFL File :",9);
TextOut(hdc,Col_2,Line_5,":",1);
if(strlen(sfl_name)>0)
{
TextOut(hdc,Col_3,Line_5,sfl_name,strlen(sfl_name));
}
//--------- Line 6 ----------------
TextOut(hdc,Col_1,Line_6,"CRT File :",9);
TextOut(hdc,Col_2,Line_6,":",1);
if(strlen(crt_name)>0)
{
TextOut(hdc,Col_3,Line_6,crt_name,strlen(crt_name));
}
//--------- Line 7 ----------------
TextOut(hdc,Col_1,Line_7,"TBL File :",9);
TextOut(hdc,Col_2,Line_7,":",1);
if(strlen(tbl_name)>0)
{
TextOut(hdc,Col_3,Line_7,tbl_name,strlen(tbl_name));
}
//--------- Line 8 ----------------
TextOut(hdc,Col_1,Line_8,pdash_Line,185);
//--------- Line 9 ----------------
TextOut(hdc,Col_4,Line_9,pdash_Line,26);
TextOut(hdc,Col_5,Line_9,"***** BLOCK SIZE *****",strlen("***** BLOCK SIZE *****"));
//--------- Line 10 ----------------
TextOut(hdc,Col_4,Line_10,"** FILE SIZE **",strlen("** FILE SIZE **"));
TextOut(hdc,Col_5,Line_10,"DEC",strlen("DEC"));
TextOut(hdc,Col_6,Line_10,"HEX",strlen("HEX"));
//--------- Line 11 ----------------
TextOut(hdc,Col_1,Line_11,pdash_Line,185);
//--------- Line 12 ----------------
TextOut(hdc,Col_1,Line_12,"Output Flash Filename",strlen("Output Flash Filename"));
TextOut(hdc,Col_2,Line_12,":",1);
if(strlen(flashFile)>0)
{
TextOut(hdc,Col_3,Line_12,flashFile,strlen(flashFile));
TextOut(hdc,Col_4,Line_12,flashFileSizeStr,strlen(flashFileSizeStr));
TextOut(hdc,Col_5,Line_12,flashDBlockSizeStr,strlen(flashDBlockSizeStr));
TextOut(hdc,Col_6,Line_12,flashHBlockSizeStr,strlen(flashHBlockSizeStr));
}
//--------- Line 13 ----------------
TextOut(hdc,Col_1,Line_13,"Output Cert Filename",strlen("Output Cert Filename"));
TextOut(hdc,Col_2,Line_13,":",1);
if(strlen(certFile)>0)
{
TextOut(hdc,Col_3,Line_13,certFile,strlen(certFile));
TextOut(hdc,Col_4,Line_13,certFileSizeStr,strlen(certFileSizeStr));
TextOut(hdc,Col_5,Line_13,certDBlockSizeStr,strlen(certDBlockSizeStr));
TextOut(hdc,Col_6,Line_13,certHBlockSizeStr,strlen(certHBlockSizeStr));
}
//--------- Line 14 ----------------
TextOut(hdc,Col_1,Line_14,"Output Script Filename",strlen("Output Script Filename"));
TextOut(hdc,Col_2,Line_14,":",1);
if(strlen(certFile)>0||strlen(scriptFile)>0)
{
TextOut(hdc,Col_3,Line_14,scriptFile,strlen(scriptFile));
//--------- Line 15 ----------------
TextOut(hdc,Col_3,Line_15,scriptFileTX,strlen(scriptFileTX));
}
return (0);
}
|
|
|
|
|
Can you show a snippet code
|
|
|
|
|
This is the routine that I call to initially paint the screen and then for subsequent updates.
int PaintScrn ()
{
pdash_Line = dash_Line;
memset(pdash_Line,'-',300);
//--------- Line 1 ----------------
TextOut(hdc,Col_1,Line_1,"Code Directory",strlen("Code Directory"));
TextOut(hdc,Col_2,Line_1,":",1);
if(strlen(code_dir) == 0)
{
TextOut(hdc,Col_3,Line_1,home_dir,strlen(home_dir));
}
else
{
TextOut(hdc,Col_3,Line_1,code_dir,strlen(code_dir));
}
//--------- Line 2 ----------------
TextOut(hdc,Col_1,Line_2,"OVL File :",12);
TextOut(hdc,Col_2,Line_2,":",1);
if(strlen(overlay1_name)>0)
{
TextOut(hdc,Col_3,Line_2,overlay1_name,strlen(overlay1_name));
}
//--------- Line 3 ----------------
if(strlen(overlay2_name)>0)
{
TextOut(hdc,Col_3,Line_3,overlay2_name,strlen(overlay2_name));
}
//--------- Line 4 ----------------
TextOut(hdc,Col_1,Line_4,"APP File :",9);
TextOut(hdc,Col_2,Line_4,":",1);
if(strlen(app_name)>0)
{
TextOut(hdc,Col_3,Line_4,app_name,strlen(app_name));
}
//--------- Line 5 ----------------
TextOut(hdc,Col_1,Line_5,"SFL File :",9);
TextOut(hdc,Col_2,Line_5,":",1);
if(strlen(sfl_name)>0)
{
TextOut(hdc,Col_3,Line_5,sfl_name,strlen(sfl_name));
}
//--------- Line 6 ----------------
TextOut(hdc,Col_1,Line_6,"CRT File :",9);
TextOut(hdc,Col_2,Line_6,":",1);
if(strlen(crt_name)>0)
{
TextOut(hdc,Col_3,Line_6,crt_name,strlen(crt_name));
}
//--------- Line 7 ----------------
TextOut(hdc,Col_1,Line_7,"TBL File :",9);
TextOut(hdc,Col_2,Line_7,":",1);
if(strlen(tbl_name)>0)
{
TextOut(hdc,Col_3,Line_7,tbl_name,strlen(tbl_name));
}
//--------- Line 8 ----------------
TextOut(hdc,Col_1,Line_8,pdash_Line,185);
//--------- Line 9 ----------------
TextOut(hdc,Col_4,Line_9,pdash_Line,26);
TextOut(hdc,Col_5,Line_9,"***** BLOCK SIZE *****",strlen("***** BLOCK SIZE *****"));
//--------- Line 10 ----------------
TextOut(hdc,Col_4,Line_10,"** FILE SIZE **",strlen("** FILE SIZE **"));
TextOut(hdc,Col_5,Line_10,"DEC",strlen("DEC"));
TextOut(hdc,Col_6,Line_10,"HEX",strlen("HEX"));
//--------- Line 11 ----------------
TextOut(hdc,Col_1,Line_11,pdash_Line,185);
//--------- Line 12 ----------------
TextOut(hdc,Col_1,Line_12,"Output Flash Filename",strlen("Output Flash Filename"));
TextOut(hdc,Col_2,Line_12,":",1);
if(strlen(flashFile)>0)
{
TextOut(hdc,Col_3,Line_12,flashFile,strlen(flashFile));
TextOut(hdc,Col_4,Line_12,flashFileSizeStr,strlen(flashFileSizeStr));
TextOut(hdc,Col_5,Line_12,flashDBlockSizeStr,strlen(flashDBlockSizeStr));
TextOut(hdc,Col_6,Line_12,flashHBlockSizeStr,strlen(flashHBlockSizeStr));
}
//--------- Line 13 ----------------
TextOut(hdc,Col_1,Line_13,"Output Cert Filename",strlen("Output Cert Filename"));
TextOut(hdc,Col_2,Line_13,":",1);
if(strlen(certFile)>0)
{
TextOut(hdc,Col_3,Line_13,certFile,strlen(certFile));
TextOut(hdc,Col_4,Line_13,certFileSizeStr,strlen(certFileSizeStr));
TextOut(hdc,Col_5,Line_13,certDBlockSizeStr,strlen(certDBlockSizeStr));
TextOut(hdc,Col_6,Line_13,certHBlockSizeStr,strlen(certHBlockSizeStr));
}
//--------- Line 14 ----------------
TextOut(hdc,Col_1,Line_14,"Output Script Filename",strlen("Output Script Filename"));
TextOut(hdc,Col_2,Line_14,":",1);
if(strlen(certFile)>0||strlen(scriptFile)>0)
{
TextOut(hdc,Col_3,Line_14,scriptFile,strlen(scriptFile));
//--------- Line 15 ----------------
TextOut(hdc,Col_3,Line_15,scriptFileTX,strlen(scriptFileTX));
}
return (0);
}
|
|
|
|
|
First of all I must say one thing your code isnt good you used of TetOut repeated but you can use from a function and in this function insert Textout.This function needs to input parameters for TextOut.How do you refresh this window did you try with Invalidate
|
|
|
|
|
use CWnd::Invalidate() or CWnd::InvalidateRect .
|
|
|
|
|
I'm new to Visual C++ and am having problems getting your suggestion to compile. This is the routine that I call initially to paint the screen and then to subsequently update the screen.
int PaintScrn ()
{
pdash_Line = dash_Line;
memset(pdash_Line,'-',300);
//--------- Line 1 ----------------
TextOut(hdc,Col_1,Line_1,"Code Directory",strlen("Code Directory"));
TextOut(hdc,Col_2,Line_1,":",1);
if(strlen(code_dir) == 0)
{
TextOut(hdc,Col_3,Line_1,home_dir,strlen(home_dir));
}
else
{
TextOut(hdc,Col_3,Line_1,code_dir,strlen(code_dir));
}
//--------- Line 2 ----------------
TextOut(hdc,Col_1,Line_2,"OVL File :",12);
TextOut(hdc,Col_2,Line_2,":",1);
if(strlen(overlay1_name)>0)
{
TextOut(hdc,Col_3,Line_2,overlay1_name,strlen(overlay1_name));
}
//--------- Line 3 ----------------
if(strlen(overlay2_name)>0)
{
TextOut(hdc,Col_3,Line_3,overlay2_name,strlen(overlay2_name));
}
//--------- Line 4 ----------------
TextOut(hdc,Col_1,Line_4,"APP File :",9);
TextOut(hdc,Col_2,Line_4,":",1);
if(strlen(app_name)>0)
{
TextOut(hdc,Col_3,Line_4,app_name,strlen(app_name));
}
//--------- Line 5 ----------------
TextOut(hdc,Col_1,Line_5,"SFL File :",9);
TextOut(hdc,Col_2,Line_5,":",1);
if(strlen(sfl_name)>0)
{
TextOut(hdc,Col_3,Line_5,sfl_name,strlen(sfl_name));
}
//--------- Line 6 ----------------
TextOut(hdc,Col_1,Line_6,"CRT File :",9);
TextOut(hdc,Col_2,Line_6,":",1);
if(strlen(crt_name)>0)
{
TextOut(hdc,Col_3,Line_6,crt_name,strlen(crt_name));
}
//--------- Line 7 ----------------
TextOut(hdc,Col_1,Line_7,"TBL File :",9);
TextOut(hdc,Col_2,Line_7,":",1);
if(strlen(tbl_name)>0)
{
TextOut(hdc,Col_3,Line_7,tbl_name,strlen(tbl_name));
}
//--------- Line 8 ----------------
TextOut(hdc,Col_1,Line_8,pdash_Line,185);
//--------- Line 9 ----------------
TextOut(hdc,Col_4,Line_9,pdash_Line,26);
TextOut(hdc,Col_5,Line_9,"***** BLOCK SIZE *****",strlen("***** BLOCK SIZE *****"));
//--------- Line 10 ----------------
TextOut(hdc,Col_4,Line_10,"** FILE SIZE **",strlen("** FILE SIZE **"));
TextOut(hdc,Col_5,Line_10,"DEC",strlen("DEC"));
TextOut(hdc,Col_6,Line_10,"HEX",strlen("HEX"));
//--------- Line 11 ----------------
TextOut(hdc,Col_1,Line_11,pdash_Line,185);
//--------- Line 12 ----------------
TextOut(hdc,Col_1,Line_12,"Output Flash Filename",strlen("Output Flash Filename"));
TextOut(hdc,Col_2,Line_12,":",1);
if(strlen(flashFile)>0)
{
TextOut(hdc,Col_3,Line_12,flashFile,strlen(flashFile));
TextOut(hdc,Col_4,Line_12,flashFileSizeStr,strlen(flashFileSizeStr));
TextOut(hdc,Col_5,Line_12,flashDBlockSizeStr,strlen(flashDBlockSizeStr));
TextOut(hdc,Col_6,Line_12,flashHBlockSizeStr,strlen(flashHBlockSizeStr));
}
//--------- Line 13 ----------------
TextOut(hdc,Col_1,Line_13,"Output Cert Filename",strlen("Output Cert Filename"));
TextOut(hdc,Col_2,Line_13,":",1);
if(strlen(certFile)>0)
{
TextOut(hdc,Col_3,Line_13,certFile,strlen(certFile));
TextOut(hdc,Col_4,Line_13,certFileSizeStr,strlen(certFileSizeStr));
TextOut(hdc,Col_5,Line_13,certDBlockSizeStr,strlen(certDBlockSizeStr));
TextOut(hdc,Col_6,Line_13,certHBlockSizeStr,strlen(certHBlockSizeStr));
}
//--------- Line 14 ----------------
TextOut(hdc,Col_1,Line_14,"Output Script Filename",strlen("Output Script Filename"));
TextOut(hdc,Col_2,Line_14,":",1);
if(strlen(certFile)>0||strlen(scriptFile)>0)
{
TextOut(hdc,Col_3,Line_14,scriptFile,strlen(scriptFile));
//--------- Line 15 ----------------
TextOut(hdc,Col_3,Line_15,scriptFileTX,strlen(scriptFileTX));
}
return (0);
}
|
|
|
|
|
I have been reading and analyzing various progs dealing with DLL's, looking up things in manuals until I understand what is happening. I have encountered the term WINAPI in one prog that used explicit linking to the DLL. There are references in MSDN, but no explanation. (Just its appearance in code snips.) For example, what does WINAPI do in the following:
typedef INT (WINAPI * lp_ptRegisterCallback)(INT callbackID, ProcAddr CBackProc);
|
|
|
|
|
WINAPI is defined as __stdcall (a calling convention). Basically it tells the compiler what sort of function it is, in particular about the arguments passed into a function and who is responsible for cleaning the stack (the function or the caller). Try searching for terms such as "calling conventions" to get a better idea.
|
|
|
|
|
Oliver123 wrote: I have been reading and analyzing various progs dealing with DLL's, looking up things in manuals until I understand what is happening. I have encountered the term WINAPI in one prog that used explicit linking to the DLL. There are references in MSDN, but no explanation. (Just its appearance in code snips.) For example, what does WINAPI do in the following:
WINAPI expands to __stdcall.
It's a windows calling convention which means the the callee is responsible for clearing the arguments passed to it from the stack.
For more information read this[^] article by Nemanja.
|
|
|
|
|
I'm curious why you did not just put the cursor somewhere on WINAPI and press the F12 key. You would have been taken to windef.h where you would have seen that WINAPI resolves to __stdcall . Searching for __stdcall would have produced a lot more.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The answer is simple. I didn't know about that F12 trick. VC++ contains quite a lot I haven't yet experienced. Thanks for the tip. I suspect it will get lots of use.
|
|
|
|
|
It's good to learn at least one new thing per day. Go forth and learn!
BTW, click Help --> Keyboard Map for other goodies.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Is there any control in Visual C++/C#.Net that offers an oppertunity to display some data from a database to the GUI in a table/scheme like form?
I have tried to use DataGrid/DataGridView and I can't get the functionality I need from it.
I'm using it for a calendar like program that shows every day horisontally.
Otherwise, is there an easy way to display what I need?
I hope that someone can help me with this.
Thanks and regards in advance.
- Jones M
|
|
|
|
|
jones_m wrote: Is there any control in Visual C++/
There is one control called CListCtrl , don't know if that is what you want, there is another one called MSFlexGrid ActiveX Control .
|
|
|
|
|
a way you can use CListCtrl with LVS_REPORT.
|
|
|
|
|
Thank you very much both. I'll take a look at it.
Is it a Managed C++ control (.Net) or just C++?
Is it possible that any of you can give me an example on how you would make something like a table/scheme with that control with some code?
Thanks & regards in advance!
- Jones M
|
|
|
|
|
|
|
Did you find your answer?
|
|
|
|
|
Thank you very much for asking WhiteSky
The reason why I haven't written anything on it yet is that I haven't got the time for trying to use it just now, but I will try it in a couple of days and write back.
Thanks once again!
- Jones M
|
|
|
|
|