|
I can't subclass the Button on MessageBox. Why ??
...............
SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTProc.........
...............
LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode == HCBT_CREATEWND)
{
HWND hWnd = (HWND) wParam;
LPCBT_CREATEWND pcb = (LPCBT_CREATEWND) lParam;
CWnd * pWnd = NULL;
TCHAR szClassName[255] = _T("\0");
GetClassName( hWnd, szClassName,sizeof(szClassName) / sizeof(TCHAR) );
if(! lstrcmp(szClassName, _T("Button")))
{
CButtonST pNewButton = new CButtonST;
if( pNewButton )
pNewButton->SubclassWindow( hWnd );
}
}
return CallNextHook( nCode, wParam, lParam);
}
But, I can't subclass MessageBox's Button. Why ??
Sorry, I'm a chinese, And my english is very poor..
-- modified at 1:27 Friday 20th April, 2007
|
|
|
|
|
Hello all,
I would like to Design and write an application that does the editing of a document (almost like an MS Word, but a with a lot cut down functionality of it). The components of the document can only be known at run time, like adding a text box, adding a Image, field, text, etc..,
I Started to design assuming its a simple task, but now I realize its a lot more than what I thought.
can any body please help me with some ideas such as how to keep track of objects inserted, with their properties, (of course I can think up to some extent, such as maintaining a list of them along with a lot of attributes)...
and maintaining them in a file and reconstructing on a file load... and so on..,
but I am curious to know how it is done in a standard industry? are there any standards defined for this purpose.. like how a document (*.doc)is stored?
Hope this stupid question is not annoying,
Haribabu
|
|
|
|
|
I developed a paint software. I load bitmap image and can edit it.
But when I want to remove image, I can't.
So what can i write in OnNewDocument() ?
Can any one help me?
Regards
Mazhar
|
|
|
|
|
How do i handle database in Win32 is there any guide book or tutorial available
Anish
|
|
|
|
|
It depends (also) on the choosen database. Anyway you may use ADO technology. There are many many books about...
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.
|
|
|
|
|
Well Please suggest me any good book. How do i use ADO in Win32 prgramming, give me some idea, or a small example if possible.
Thanks in Advance,
Anish
Anish
|
|
|
|
|
Check Here[^] and see if any of these database articles are using Win32 instead of MFC.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
the simpler is DAO (ms access db only) and ODBC
|
|
|
|
|
It depends.
If you're quite familiar with importing COM DLLs via #import statement, then ADO is a viable solution.
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.
|
|
|
|
|
Simpler, maybe, but almost deprecated...
"Microsoft recommends that you use OLE DB Templates or ODBC for new projects. You should only use
DAO in maintaining existing applications."
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Are there any functions in MS C++, C, MFC, STL etc to make a single call to find files matching multiple specs. eg "c:\m*.*;c:\n*.*". That will result in a single call to the file system.
|
|
|
|
|
Look up "FindFirstFile" and its associated functions.
Phil
|
|
|
|
|
It does not appear to allow multiple file specs.
I have tried a number of specs for the first param
c:\m*.*;n*.*
c:\m*.*;c:\n*.*
c:\m*.*|n*.*
c:\(m|n)*.*
c:\[m|n]*.*
Jay
-- modified at 20:22 Thursday 19th April, 2007
|
|
|
|
|
Ok, what about looking for *.* and doing the test for the filename masks in your method? Or are you looking for the functions to do the mask work for you?
Phil
|
|
|
|
|
did you try _findfirst() and _findnext() ?
|
|
|
|
|
Hello, I have an SDI application (MFC). I need to have an array of double numbers that can be sorted.I tried to use Array class from System namespace(.Net framework class) in one of my MFC classes but when I add
using namespace System;
to the begining of header file of my MFC class I get lots of error messages first one tells :
'System': a namespace with this name does not exist
to add a variable of class Array(System) to my MFC class, I wrote
array<double>^ m_dFrequencies
Can someone please give me a little help with that?
Thank you.
|
|
|
|
|
MFC is native C++.
System:: , and things such as array<>^ is C++/CLI (the Microsoft C++ extension for the .NET framework).
you're confusing/mixing both. don't.
do you want to code for .NET, or with MFC ?
|
|
|
|
|
thanks toxcct for reply,
My application which is pretty big and has about 20 classes is completely written using MFC but in my application I need an array with double type members whose members can be sorted. In all classes that are availabe under MFC such functionality dose not exist. Even sort capability dose not exist in "vector" and "queue". Array(System) has sort capability. I want to introduce just one member of type Array(System) to one of my MFC classes, so I'll be able to use sort functionality. How?
Thanks again.
|
|
|
|
|
Electronic75 wrote: Even sort capability dose not exist in "vector" and "queue
because you've got to learn about STL.
use std::vector<double> for your storage, and std::sort(vec1.begin(), vec1.end()) to sort it (with vec1 being an instance of the vector presented here.
to use those, you'll need to #include <vector> and <algorithm>
|
|
|
|
|
Thanks alot I'll try it.
|
|
|
|
|
Hi all. I've taken the liberty in "dissecting" some code so i can understand it better. However, im having a hell of a time trying to figure out how to convert it from C to C++ .
My error is this:
<br />
error C2664: 'recvfrom' : cannot convert parameter 6 from 'unsigned int *' to 'int *'<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
Error executing cl.exe<br />
The offending code is as follows:
<br />
if ((respStringLen = recvfrom(sock, echoBuffer, ECHOMAX, 0, (struct sockaddr *) &fromAddr, <br />
&fromSize)) != echoStringLen)<br />
DieWithError("recvfrom() failed");<br />
<br />
if (echoServAddr.sin_addr.s_addr != fromAddr.sin_addr.s_addr){<br />
fprintf(stderr,"Error: received a packet from unknown source.\n");<br />
exit(1);<br />
}<br />
Im hoping i dont have to change too much, googling around i see others with the same problem but no solution. Any suggestions would be greatly appreciated. Thanx in advance!
|
|
|
|
|
Either change the definition of the fromSize variable from unsigned int to int, or change &fromSize to one of "(int*) &fromSize", "static_cast<int*>(&fromSize)", or "reinterpret_cast<int*>(&fromSize)" (depending on what you're trying to accomplish).
|
|
|
|
|
you're providing the culprit line of code and the error (and that's good already), but not enough. I'd like to know what is the exact synopsys of the function recvfrom() and the exact declaration of the variable fromSize .
anyway, the code you're showing is not C++ at all. you're certainly porting it into a more recent compiler, thus the error
|
|
|
|
|
The error is telling you what's wrong. The function takes an int* parameter, but you're passing an unsigned* instead. Change fromSize to an int .
|
|
|
|