|
Chris Richardson wrote:
// Inside your thread. Make sure NOT to mess with any MFC stuff here.EndDialog( hWndYourDialog, IDYES );
I tried it again, this time it worked! Thank you very much!!!
P.S. I used 4774 instead of IDYES, it is the id of the Yes button on the dialog.
EndDialog(hWndDialog, 4774);
|
|
|
|
|
I'm a beginner and I already know how to use dc.MoveTo() and dc.LineTo(), but how can I draw a dotted line instead of solid? Do I need to create a brush, and how would I do it?
The line should look like this (vertical, 3 pixel width, X = black pixel):
x x
x
x x
x
x x
thanks for help!
|
|
|
|
|
You can create pens that are dashed or dotted with these pen styles:
PS_DASH Creates a dashed pen. Valid only when the pen width is 1 or less, in device units.
PS_DOT Creates a dotted pen. Valid only when the pen width is 1 or less, in device units.
PS_DASHDOT Creates a pen with alternating dashes and dots. Valid only when the pen width is 1 or less, in device units.
PS_DASHDOTDOT Creates a pen with alternating dashes and double dots. Valid only when the pen width is 1 or less, in device units.
Brushes can be created with a number of styles ( and a lot more in GDI+ ) that may suit you better.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
A pen with PS_DOT doesn't make a fine dotted line, I tried this.
could you give me an example who to make and use a brush, please?
|
|
|
|
|
Is there any special trick to send a hex value through a serial port?
Thanks, p. t.
|
|
|
|
|
I have an MDI application and need a Combo box that is located as a Toolbar item . This is analogous to the "find in files " Combo Box in the Visual C++ IDE .
Please help
|
|
|
|
|
Please look in MSDN, CodeProject, google, ... ton of people did this already ...
Max.
|
|
|
|
|
what's the difference between a callback function and a function pointer? can anyone show me a short code snippet?
For example, here's a typedef and function pointer:
typedef void (*PostProcessFunc) (int&, ubt&);
void ProcessFunc(PostProcessFunc, int&, int&);
and is CALLBACK a keyword...?
For example:
HDDEDATA CALLBACK DdeCallback(uType, uFmt, hconv, hsz1,
hsz2, hdata, dwData1, dwData2)
I cant find CALLBACK statement/keyword from MSDN....
norm
|
|
|
|
|
CALLBACK is defined in many places, including windefs.h and wtypes.h.
for most people, i think it's probably defined as:
#define CALLBACK __stdcall
but, no there's no real difference between a what you use a function pointer for and what a callback function accomplishes. they both provide a way for one function to call another.
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
Actually there is a difference. A function pointer can be used in an Object, a CALLBACK can't.
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
S van Leent wrote:
A function pointer can be used in an Object
care to expand on that ?
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
Ah, yes, I do care.
A function pointer could also point to a __thiscall function, meaning that it can be used as a non-static member of a class.
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
ah. true. (tho it looks like the original poster was asking about traditional windows CALLBACKs)
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
A CALLBACK or __stdcall, is a calling convention, just like _cdecl, __declspec, __fastcall and __thiscall. It is used to parse this to a function, who can use this to give data back.
A CALLBACK function cannot be used in an Object Oriented environment, so it is not recommended to use it in an OO-environment. Windows makes use of these functions so much, that it is an impossibility to name them all. The most common used CALLBACK (I think) is a Window Procedure, in the following form:
HRESULT CALLBACK WndProc(HWND, int, WPARAM, LPARAM);
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
BOOL CALLBACK EnumFontProc (LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData)
{
TRACE("Found a font named: %s\n", lplf->lfFaceName);
return TRUE;
}
EnumFonts (dc, 0,(FONTENUMPROC) EnumFontProc, (LPARAM)0);
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
|
Thanks, norm,...I was wondering about the CALLBACKs too,...they seem like an anachronism. But, you see them used in virtually all windows code,...so, I assume that there must be an advantage to using this function. I'm wondering,...what exactly does the Visual C++ compiler do with them?
In Petzold's Programming Windows, the author states: The call-back function is a function in your program that is called from Windows. The best-known example of a CALLBACK function is the program's window procedure. You tell Windows the address of the windows procedure when registering the window class, and then Windows calls the function when sending messages to the program. Like a window procedure, a call-back function must be defined as CALLBACK because it is called by Windows from outside the code space of the program.
You know, I love geek-speak, but I'm not sure I understand it.
|
|
|
|
|
Nebulous Person wrote:
they seem like an anachronism
they're not an anachronism as much as they are a very powerful and advanced feature of C. yes they seem clumsy when compared to how you do similar things in C++, but Windows wasn't written in C++, it was written in C and Assembly.
in pure C++, you don't often need function pointers, since you can just pass an object and call members functions on that object; the object, in effect if not in reality, carries a function pointer for each of its member functions. but C has no "objects", so you have to pass the function pointers out in the open.
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
Chris Losinger,
Ya know, I'm very new to C++ and Visual C++, but, I've found that reading the threads on this forum is probably the best source of information available to us 'code nitwits'. Thanks,...I appreciate the perspective. My brain is hemorhhaging intel.
|
|
|
|
|
You might want to check out all the recent C++ articles on creating delegates using STL, which are essentially a breed of C++-esque callback.
Though frowned upon in OOP, incidentally, you can use straight callback functions in C++. I've done it where a C program calls a DLL C function stub which is defined in a .cpp file, which in turn passes it onto an object instance, with a callback as a parameter. The C++ instance, after doing some work, later calls the callback. Pretty convoluted, but a project I worked on required it.
-- ian
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
How can I delete EOF in a file (in binary mode)?.
Thanks
|
|
|
|
|
you can't.
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
I want to chek duplicate line in text file
Example:
If in "1.txt" has this data inside
50B82D3F9D3
2C051C76C7D
5804EBB2BB8
559AAC90CEE
DA64B9F10CC
B9A6A9866A9
AFF45E93F23
.
.
.
.
45788887454
B9A6A9866A9
This above text file has duplicate line
"B9A6A9866A9"
I want to write proram to check duplicate line.
Do you know how to do that? (Now I can use CStdioFile (ReadString, WriteString) and show Messagebox but not have idea to do that.)
Thank you for your answer.
|
|
|
|
|
is this for school ?
If you'd have to explain how to do this in your own words, without code, how would you anwser this, how would YOU solve the problem, once you know how to solve the problem, coding is easier. and it's from that point that I can/will help you !
Max.
|
|
|
|
|
two words: strcmp and fopen .
The rest is left as an exercise to the reader.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|