|
OK, I found it:
<br />
SendMessage(WM_LBUTTONDOWN);<br />
SendMessage(WM_LBUTTONUP);<br />
and it seems to work. (pfew )
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Hi!
In a dialog based application with a multiline edit box I’m trying to count the number of enter hits. I tried to use code like this:
void CNanoDlg::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar==VK_RETURN)
{
counter++;
}
CDialog::OnChar(nChar, nRepCnt, nFlags);
}
The code doesn’t work.
Any Ideas?
Thanks in advance.
|
|
|
|
|
Do this:
message map:
<br />
ON_WM_GETDLGCODE() <br />
header file:
<br />
afx_msg UINT OnGetDlgCode( );<br />
in code:
<br />
UINT CtrlFlexArray::OnGetDlgCode(){<br />
return DLGC_WANTALLKEYS;<br />
}
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I almost got it. But when I press enter or any different key in the edit box the function OnGetDlgCode()
returns always the same result so I’m not able to count enter hits. Am I missing something?
Regards.
|
|
|
|
|
I dunno,
Do you handle your keystrokes in OnKeyDown (or Up) messagehandler?
in message map:
ON_WM_KEYDOWN()
in header:
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
in code:
void yourclas::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags){<br />
}
if you do have this I wouldn't know, what you could have forgotten.
Hope this helps.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
The code that you wrote works fine in SDI or MDI application. But I have dialog based application with edit box in which I want to count enter hits.
|
|
|
|
|
Try adding a button to your dialog,
set it as default button and make it invisible.
(note: it could take the ESC button too)
(note: if it doesn't work, set it's focus explicitly)
just an idea, hope it works.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
HI,
Plz tell me differnce between Win32 and MFC programming
thanx
Regards.
|
|
|
|
|
Win32 is the programming interface to Windows, including all the Windows functions.
MFC is an application framework that includes much of the Win32 functionality, and a lot more.
|
|
|
|
|
thanx
but i want to know
When we use File ->New(PRoject tab)
there r options many ....
wts there differece win32 application and MFC wizard,
is that we can not use MFC classes in Win32 application or some else
thanx
Regards.
|
|
|
|
|
Check the following links
FOR MFC:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_overview.3a_.creating_an_mfc_exe_program.asp
FOR WIN32:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcgrfoverviewwin32appwizard.asp
|
|
|
|
|
Per MSDN:
MFC is an "application framework" for programming in Microsoft Windows. Written in C++, MFC provides much of the code necessary for managing windows, menus, and dialog boxes; performing basic input/output; storing collections of data objects; and so on. All you need to do is add your application-specific code into this framework. The MFC framework is a powerful approach that lets you build upon the work of expert programmers for Windows. MFC shortens development time; makes code more portable; provides tremendous support without reducing programming freedom and flexibility; and gives easy access to "hard to program" user-interface elements and technologies.
The Win32 application programming interface (API) defines the 32-bit members of the Windows operating system family from the programmer's point of view. Some members of the Windows family use the entire Win32 API, while others use subsets. MFC encapsulates, or "wraps," much of (but not all of) the Win32 API. In general, MFC supplies classes representing key Windows objects, such as windows, dialog boxes, brushes, pens, and fonts. The member functions of these classes wrap most of the important Win32 API functions associated with the encapsulated object. That is, the MFC class member function calls the Win32 API function.
With Visual C++, you can program for Windows using either C or C++ and the Win32 API, or using C++ and MFC.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Actually,let me explain the diffence between them in wasy way.
i think you know dosbased c and c++ before going for the MFC and win32 api.
here is the solution,
you can win32 api as windows based c and mFC as Windows Based c++.
basically as dos based c is more close to system same way win32 are more close to system and dos based c++ is oops based same way the mfc is oops based.
and as you know c++ use wrappper of c to provide easy handlling of function ,same way mfc provide wrapper some commonly used win32 api function,i think that enough.
if you want more search CP
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hello,
I have a group of files, how do I check the integrity of the files with a the given value which summarize the files content. For a single files, I know there are CRC. But how about a group files?
Any proven methods?
thanks
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
The only way I have seen a group of files checked is with an additional SFV file.
I believe it uses CRCs for each file in the set. A search for SFV on google may help you out.
Sorry I can not be any more help as I have not used them myself.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Does anyone have a way of drawing with the GDI API (LineTo, ArcTo, etc) and create anti-alising (smoother looking vectors) ? Adobe Illustrator, CorelDraw do it, are they drawing to an off screen image and bitblting ? or is there some other way ? I don't want to use GDI+
Thanks in advance
Tony Teveris
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
|
|
|
|
|
Okay here's a problem I am having:
I create a pointer to a char like so:
char *test = new char;
then I pass that pointer to a class member function which fills it with data from a file. Heres the code for that:
bool FileManager::ReadString(LPSTR StringData)
{
char SingleChar;
bool done = false;
while (done != true)
{
if(ReadData(&SingleChar, 1)==2)
{
return true;
}
switch (SingleChar)
{
case 10:
case 13:
{
done=true;
}break;
default:
{
*StringData = SingleChar;
StringData++;
}break;
}
}
*StringData = 0;
StringData++;
return true;
}
Then afterwards in the function that called the member function I do a:
delete test;
When it runs this piece of code I get:
Debug Error!
Program: c:\JD's Projects\FileManager\Debug\FileManager.exe
DAMAGE: after Normal block (#38) at 0x00851FC0.
Any Ideas?
thanks,
JD
|
|
|
|
|
Your test variable is a pointer to a SINGLE char value. If you want to store an array of chars i.e. a string, you will have to declare an array:
char* pArray = new char[NumChars + 1];
where NumChars is the number of characters you want to store. If you don't know in advance how many you want to store, pick a large constant value. Note the extra one added to accommodate the null-terminator at the end of the string. This is a style issue, you may wish to include the null-terminator in the NumChars count.
Now when you use your pointer arithmetic:
StringData++;
you will be using valid allocated memory. Remember that when you come to deallocate an array, the syntax is as follows:
delete []pArray; // Note the square brackets
On a related note, you might want to look at the standard library's basic_string<> template (STL). use MSDN - it can simpify string handling a great deal and is a good way to learn about templates.
Hope that helps.
|
|
|
|
|
I'm working on a program that at one point needs to display the user's "public" IP address. I'm sure I'm forgetting the technical name for this, so for now "public" will have to do. Assuming their running through a router, all the techniques I know will return addresses like 192.168.1.100 or something similar provided by their router. How do I find (programatically) one IP address as seen by external sites?
Thanks!
|
|
|
|
|
Assuming the router supports SNMP. You will have to interogate the routers routing table in order to determine the public ip addresses used.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hello,
it seems something has drastically changed on Windows 2003, if we write to the registry.
I was using the code example from JOHN11 (How to Save and Restore Registry Keys) which is working without any problems on Windows 2000.
If I use the same tool on 2003, export the registry to a file works fine, but importing takes very long. (using option "/R" from JOHN11's tool) The function "RegRestoreKey" hangs some how. I was using the same registry key (which was generating about an 8 MB file). No problems on 2000 (about 30 seconds). On windows 2003 the function returned after about 15 minutes.
I was also chaning the possible parameters without success (REG_NO_LAZY_FLUSH)
Do you have any clue if there is a new "registry" feature on 2003 which delays the "RegRestoreKey" ?
Can we tune this somewhere?
Thanks a bunch for your hints!
Best regards
Farby
|
|
|
|
|
I just finished making a file splitter, and im stumped as to what i should move on to, i would like to do something else with file io, anyone got any suggestions as to what i could make?
|
|
|
|
|
A file joiner ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
When I was in undergraduate school, we did quite a few programs that used stdio as the input, and stdout as the output. We were on a Unix box so piping was a big deal, too. Here are some smaller projects that taught, and at the same time, were easy to implement:
Create a file with random numbers, one per line. Pipe that file through an averager, and a sorter (not the one that comes with the OS).
A grading program. Each line of the file should contain the student's name, followed by 0 or more scores, each separated by a vertical bar (or some other easy-to-read character). Pipe that file through a grading program to give each student's average score, and perhaps a letter grade. Sort students by average score.
Roman numeral to arabic converter.
Palindromes
A program that, given a .h or .c file as a starting point, will go through the file and show the #include hierarchy. Each #include encounter will be a "recursive" call. Determine if a circular dependency exists.
A program that will determine if a pattern matches an input string.
A program that will determine if a number is prime.
These are just some off the top of my head.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Is it possible to create a class with template parameters that is derived from a CView and then dynamically create it in an MDI/SDI framework? If so, how would one go about doing this?
Thanks!
|
|
|
|