|
From what i've read, making a window is the "regular" way of doing this with WSAAsyncSelect. It's really not difficult at all, infact, just cut and paste the code below into your project
if ((Window = MakeWorkerWindow()) == NULL)
return FALSE;
HWND MakeWorkerWindow(void)
{
WNDCLASS wndclass;
CHAR *ProviderClass = "NetworkWindow";
HWND Window;
char szError[128];
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)NetworkWindowProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = NULL;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = ProviderClass;
if (RegisterClass(&wndclass) == 0)
{
wsprintf(szError,"RegisterClass() failed with error %d\r\n", GetLastError());
MessageBox(NULL,szError,NULL,MB_OK);
return NULL;
}
// Create a window.
if ((Window = CreateWindow(
ProviderClass,
"",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
NULL,
NULL)) == NULL)
{
wsprintf(szError,"NetworkWindow Creation Failed #%d",GetLastError());
MessageBox(NULL,szError,NULL,MB_OK);
return NULL;
}
return Window;
}
|
|
|
|
|
Yeah, i know that method, but i hate creating hidden windows just to route messages and i DONT WANT TO DO THAT in a console program!
|
|
|
|
|
hi,
I have a handle to a bitmap and what to display it. Whta can be options?
karanba
|
|
|
|
|
Select it into a device context and the BitBlt it to the place you want it to be seen.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
i used this method in OnInitDialog() & it's not working
CWnd *pWnd;
LOGFONT lf;
CFont font;
pWnd = GetDlgItem(IDC_STATIC_LINK);
pWnd->GetFont()->GetLogFont(&lf);
lf.lfUnderline = TRUE;
font.CreateFontIndirect(&lf);
pWnd->SetFont(&font);
any ideas?
|
|
|
|
|
override the OnCtlCOlor() message and set it there
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
It's working !! Thanx
|
|
|
|
|
How can I declare function pointer to be put into a map ??
like:
std::map
|
|
|
|
|
This should work:
typedef bool func(long, CDataBase*);
std::map<long, func*> mapLongToFunc; Though i suppose there's prolly a more concise way of doing it.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
Your syntax is a little off, it should be:
typedef bool (*func)(long, CDataBase*);
std::map<long, func> mapLongToFunc;
--Mike--
Actual sign at the laundromat I go to: "No tinting or dying"
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Thank you. I stand corrected
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
Are there any tools can generate header file from a cpp file automatically?
For example it generate the cpp file:
double sum(double a, double b)
{return a + b;}
bool islowercase(char ch)
{return ('a' <= ch && 'z' >= ch);}
void main()
{printf("A");}
into a header file as:
double sum(double, double);
bool islowercase(char);
|
|
|
|
|
it really wouldnt be so difficult to process the file and figure out the function def lines and write them to a header file
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
ivex wrote:
Are there any tools can generate header file from a cpp file automatically?
Not that i've heard, although i'd love to see one. This is something that really grates on me when reading or writing C++ after seeing Java or C# code.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
yer there is
a perl script called "makeh"
Bryce
|
|
|
|
|
If you're using VC6, I think you haven't studied the compiler switches before asking. But then "void main" also displays something. :->
Try /Zg
|
|
|
|
|
How can i replace the standart window class name for dialog window, given by MFC (#32770) with my one?
|
|
|
|
|
That is the standard name of the dialog class given by windows.
All that you have to do is subclass the dialog with SetWindowLong.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
First of all, unless you want to change some specific behavior for all dialogs, why would you want to do that?
I don't quite remember (long time since I did this) but you have to register a new class, with a new window procedure (which pases unhandled messages to DefDlgProc instead of DefWindowProc), and a cbWndExtra value of DLGWINDOWEXTRA (30 bytes last time I checked.)
Also you must add a CLASS statement to the dialog box template in the RC file.
Then you can use CreateDialog or DialogBox to display the dialog.
(Ok, everything here was SDK instructions, but not difficult to translate to MFC)
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
CPUA: 0xC0DE - No Sonork yet
MiniPutt best: 20
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
I want to do that because there is a requirement an other program to take a handle to my window. This is done with FindWindow function. The inconvenience is, that there may be an other dialog windows, and FindWindow find out one of them. I need my window class to be unique.
I solved the problem. I have not written a new dialog procedure, only obtain a class info with GetClassInfo function for #32770 and replace the name with my own. Then i registered the new class, and added a CLASS statement into .rc-file. Thank you!
|
|
|
|
|
Hi,
I'm using Visual Studio .Net for my project. When I create the exe and run it on a 2K system. It tells me I am missing msvcrt70.dll. After debugging it, I found that it happens when I call LoadLibrary. My question is why does LoadLibrary depend on this file and is there a way to remove the dependancy?
-Thanks
|
|
|
|
|
No, you simply need this file as your program uses some of its functions. You have to distribute it along with your program, the other solution is to write application without use of MFC (i am not familiar with .net, so i dont know if that is possible (it should be)), but i guess you dont want that either .
|
|
|
|
|
I'm not using MFC. Anyway, I figured out why it was dependant on it and was able to remove the dependancy.
Thanks
|
|
|
|
|
Hi!Tell me,please,how can I put Wallpaper(background)in to the view of my project and what type of file it must be (.bmp or ...)
Thank you very much!
|
|
|
|
|
You have to handle WM_ERASEBKGND .
Irina.T wrote:
what type of file it must be (.bmp or ...)
I don't think there is limitation for it.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|