|
1.) Is MFC thread-safe by itself?
I played aruond with Joseph Newcomers (veryvery good) Queue-class and dicoverd, that it works fine without any syncs! So I used CLists directly in an MT-App and it works fine!
2.) Can I build a CDialogBAR from an in memory resource, a DLGTEMPLATE?
I prefer memorybased Dialogs then .rc-based one for several reasons and I wanna do so with DialogBars, too. Is it possible?
What do you think about DLGTEMPLATE-Dialogs at all, any pros or contras?
mfg HintiFlo
|
|
|
|
|
I've inherited a class CMyPrintDialog from CPrintDialog, and it's initialisation happens in OnInitDialog(). OnInitDialog is only called in the release version. In the debug version, the dialog remains uninitialised!
Does anyone know why?
Thanks
Jonnie
|
|
|
|
|
Woah, you mean that if you put a breakpoint inside the OnInitDialog function, it never stops there? The only possible explanation is that it's using another class. Check and make sure you don't already have a class with the same name defined somewhere else. I got bitten by this problem a long time ago -- redefining a class somewhere else with the same name. I don't remember why the compiler or linker never caught it, but it drove me nuts for a long time before I discovered it.
Regards,
Alvaro
|
|
|
|
|
I've run into this problem in the past; it appears to be either a bug in some versions of MFC, or small version differences: debug EXEs compiled (and working) on one developer's machine would fail to work on another. Installing the latest service pack fixed it for me. You might also try just re-installing the version you have (if you don't have access to the latest service pack, or have a slow internet connection for instance), but i can't say whether this will have any effect or not.
farewell goodnight last one out turn out the lightsSmashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Thanks for your help. It was an MFC bug fixed in the Visual Studio 6.0 Service Pack 1. Works like a dream now.
Jonnie
|
|
|
|
|
Hi,
I have the following code
WNDCLASS wc;
// Source window
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = NULL;//(WNDPROC)SourceWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;//UD_MAIN_WINDOW_EXTRA_BYTE;
wc.hInstance = A_hInst;
wc.hIcon = LoadIcon( A_hInst, MAKEINTRESOURCE(ICO_UMAXLOGO) );
wc.hCursor = LoadCursor( NULL, IDC_ARROW );
wc.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
wc.lpszMenuName = NULL;
wc.lpszClassName = kMAIN_WINDOW_CLASS; // define in TW_LAYOT.H
if( !RegisterClass( &wc ) )
return FALSE;
But RegisterClass() fails in windows 98.
Can anyone pl help me.
Neha
|
|
|
|
|
Apart from RegisterClassEx being a better function to use, what is the error returned from GetLastError when RegisterClass fails?
Michael
|
|
|
|
|
I have downloaded & unzipped the STLport library. There are several make files found.What needs to be done , so that I can start using it.
Thanks very much
|
|
|
|
|
The procedure differs depending on your compiler. There are several good .html docs in the /doc subdirectory of your STLPort directory. For example to build the STLPort for Visual C++ 6, you would go to a command prompt, run VCVARS32.bat to register the build evnironment variables, then run
nmake /f vc6.mak clean all
and watch it compile (takes a few minutes)
In order to use it, you would need to set it in your include search path BEFORE any other paths which would contain another STL implementation.
|
|
|
|
|
Hi,
Can Any one tell me how can i close one application from other one as i have the path of first application in the second application while sing registry....
Neo.
|
|
|
|
|
CWnd pwnd = FindWindow(LPCTSTR lpszClassName, LPCTSTR lpszWindowName );
PostMessage(pwnd->m_hWnd, WM_CLOSE, 0, 0);
You can find lpszClassName and lpszWindowName parameters of FindWindow() with the Spy++ utility from Visual Studio Tools
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
... or WM_QUIT
Normski. - Professional Windows Programmer
|
|
|
|
|
Hi All,
I wanted to defines some BITMAP resources dynamically. If I wanted to display a pre-determined bitmap in my dialogbox, then I define a BITMAP resource and calling LoadBitmap() in pannel of that dialog-box. The defination in project.rc file goes like
IDB_USER_BITMAP BITMAP DISCARDABLE "images_1\\user-pannel.bmp"
What I wanted to achieve here is something like
#define PRODUCT_IMAGE_PATH "images_1"
IDB_USER_BITMAP BITMAP DISCARDABLE PRODUCT_IMAGE_PATH+"\\user-pannel.bmp"
Thus at compile time it decide about resource-id and which resource to incorporate.
I wanted this to make smaller size of my executable as well as eleminating manual task of folders renaming.
Thanks.
-- Sumit
Sumit Pandya
-- modified 1-Aug-19 21:02pm.
|
|
|
|
|
I've got a problem with the API "createipForwardEntry"). I'm trying to add a routing rule in the piece of code hereunder. It works just fine. However, if i use the IP address assigned to my ethernetcard as the "next hop" (thereby making it the default gateway for the particular network segment) it fails me. Can anyone help me out?
<br />
PMIB_IPFORWARDROW pRow = NULL;<br />
ULONG dwSize = 0;<br />
DWORD dwStatus = 0;<br />
<br />
pRow = (PMIB_IPFORWARDROW)malloc(sizeof(MIB_IPFORWARDROW));<br />
<br />
if (!pRow) {<br />
MessageBox("Malloc failed, Out of Memory!\r\n");<br />
exit(1);<br />
}<br />
<br />
pRow->dwForwardDest = inet_addr("172.0.0.0");<br />
pRow->dwForwardNextHop = inet_addr("172.31.64.9");
pRow->dwForwardMask = inet_addr("255.0.0.0");<br />
pRow->dwForwardIfIndex = 2;<br />
pRow->dwForwardType = 4;<br />
pRow->dwForwardProto = MIB_IPPROTO_NETMGMT;<br />
pRow->dwForwardAge = 0;<br />
pRow->dwForwardMetric1 = 30; <br />
<br />
dwStatus = createipForwardEntry(pRow);<br />
<br />
if (dwStatus == NO_ERROR)<br />
MessageBox("Route Added Successfully\n");<br />
else if (dwStatus == ERROR_INVALID_PARAMETER)<br />
MessageBox("Invalid Parameter\n");<br />
else <br />
DisplayErrorMessage(dwStatus);<br />
<br />
if (pRow)<br />
free(pRow); <br />
pretty please?
|
|
|
|
|
But it doesn't make sense to add a local network route loop like that!
Picture this:
Your local IP is 172.31.64.9, your local mask is (probably) 255.255.255.0.
That net config makes an implicit route: it tells IP that 172.31.64.0/24 is directly connected.
Picture adding your route command to that: route add 172.0.0.0 mask 255.0.0.0 172.31.64.9.
That route tells IP that the host 172.31.64.9 knows how to route to the whole of 172/8. But it doesn't! Your IP config tells windows that knows how to route to 172.31.64.0/24!
Basically, you can never set a gateway to local with an explicit route in IP.
The one big exception to this is if your route applied to a different IF.
I hope that makes some sense?!
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Actually, the interface which has 172.31.64.9 is a VPN interface (Intel Netstructure), getting a DHCP address every time a connection is set up. So the interface does know how to route 172.0.0.0. As I stated in my sourcecode sample "route add 172.0.0.0 mask 255.0.0.0 172.31.64.9 metric 50 if 2" work just fine. It does make sense.....
|
|
|
|
|
if 172.31.64.9 knows how to route to 172.0.0.0/24, then DHCP will have given a mask of 255.0.0.0 to go with that address. If it did, then yay, your routing works already. If it didn't then trying to manually make a route to that net on that interface won't work.
--- your manual route says that 172.31.64.9 can address the whole of 172.0.0.0
--- your DHCP assigned mask (eg. 255.255.255.0) doesn't agree, hence a conflict.
You can never specify explicit routing rules for local interfaces. IP knows how to route to these already, becuase of their netmask.
The above only applies if you have a single interface.
But, if your DHCP assigned address (172.31.64.9/255.255.255.0) came with a default gateway allocation (eg 172.31.64.254), then you can probably route the whole of 172.0.0.0 to that. eg "route add 172.0.0.0 mask 255.0.0.0 172.31.64.254". That would work.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
No offense, but the routing command i pasted there works like a charm; and besides, that wasn't my question, the question had to do with C++ and CreateIpForwardEntry.
Sorry.
|
|
|
|
|
I know that was your original question. My point is that perhaps CreateIpForwardEntry returns an error in those precise circumstances because the route you're trying to create is invalid!
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I'm missing the point why it should fail. route.exe calls createIpForwardEntry as well (iphlpapi.dll) and from the commandline it works like a charm; I really see no reason why it should fail.
|
|
|
|
|
Is there anybody who knows how to program using the BHO(Browser helper obj)?
I've searched the www,but got no information except for those from MSDN.
|
|
|
|
|
I've done a little bit recently and got most of my info from MSDN, mainly the articles by Dino Esposito.
What is your question?
Michael
|
|
|
|
|
I'm making a client and server program. So far the server works great, but the client is having a little trouble. The problem is coming from 2 connection classes, which are both derived from CBaseSocket which is derived from CAsyncSocket.
One of the classes is CListen and the other is CMessage. CListen listens for a connection and CMessage sends messages to another client program.
Right now, CListen will receive a message from another client program through the socket that basically says "I want to send a message to you, reply please."
CListen then does this:
CBaseSocket *anothersocket;
if(message == "I want to send a message to you")
{
anothersocket = new CMessage();
}
SOCKET socktemp = Detach();
CString sendstring = "Ok, send the message on this socket!";
anothersocket->AttachToSocketAndSend(socktemp, sendstring);
The AttachToSocketAndSend function 'Attach's the CMessage object to the socket and then sends the message.
Basically I want this to transfer control of the socket to the CMessage object. I want the CMessage's OnReceive function to be triggered when the other client sends more data. My problem is that whenever data is received through the the socket, it gets routed to CListen's OnReceive() function (instead of CMessage's.. I want CMessage to handle the received data now)
Can anyone help?
|
|
|
|
|
Hello,
Is there a way to pass in the account name and password in the 12th and 13th parameters of CreateService, by obtaining them. My goal is to pass in the values when the computer is rebooted and the services automatically start.
Thank You
|
|
|
|
|
There is no way to get the password for an account, sorry. It'd be a security hole, and besides the actual passwords aren't stored anywhere, only their hashes.
--Mike--
"Why you keep calling me Jesús? I look Puerto Rican to you?"
-- Samuel L. Jackson in Die Hard 3
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|