|
Try this:
In the constructor of your dialog class, change: m_hIcon = AfxGetApp()->LoadIcon(IDR_YOURICON)
And this I think will change the icon of your dialog title bar
"Needless redundancy is the hobgoblin of software engineering." - Peter Darnell
|
|
|
|
|
But I'm not using MFC
|
|
|
|
|
I set an icon for a dialog as follows :
m_hIcon = (HICON)LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDI_SELECTSTRUCTURE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR) ;
SetIcon(m_hIcon, FALSE);
This is done in the InitDialog()
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
I cannot find pure API function similar to CWnd::SetIcon ()
|
|
|
|
|
The MFC function translates to this:
_AFXWIN_INLINE HICON CWnd::SetIcon(HICON hIcon, BOOL bBigIcon)
{ ASSERT(::IsWindow(m_hWnd)); return (HICON)::SendMessage(m_hWnd, WM_SETICON, bBigIcon, (LPARAM)hIcon); }
So you need to use SendMessage to do the equivalent.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
|
What really is Managed C++, opposed to normal C++ ????
Thanks !
Jerome
|
|
|
|
|
I believe it's C++ compiled to the .NET CLR. This topic is getting a lot of discussion in the lounge right now.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Managed C++ allows the developer to reap the benefits of other .NET languages such as C#, VB.NET. These benefits include:
Automatic garbage collection.
Intergration with the .NET Framework
From the VS.NET MSDN:
A primary focus of Visual C++.NET is to provide a powerful and simple way to design applications that target the .NET Framework common language runtime (CLR). The CLR offers a run-time environment that manages the execution of code. When you develop code using Visual C++.NET, you can compile your application or component with managed code, which is code that the CLR supports with services that make component programming easier. Managed Extensions for C++ allow you to easily create new .NET Framework components with C++ code, easily migrate existing native C++ code to use the .NET Framework, and access unchanged C++ components from the .NET components.
|
|
|
|
|
I have written an extension DLL which always have had on and off problems with resources. I've always been able to get it working, however, until a few days ago when something went haywire. Suddenly NONE of my resources in the DLL are available from the applications using it. I've tried almost everything, moving the source to a new DLL project, doing the same to the applications. Restoring an old, known-to-work, version of the resource files, but nothing seems to help!
Is it possible, in the source, to create a situation where the resources are never inserted in the resource chain, or their ID-values become scrambled somehow?
Stepping through the failing calls to LoadString (which is the first place the problem makes itself known, though the program can't find any dialog or bitmap resources either) I can see that it searches my DLL for the resource but for some reason doesn't find it.
I've also checked the DLL with a resource explorer and found all the resources to be present and accounted for.
What is going on? Thanks in advance for any input you might have!
|
|
|
|
|
A possible guess at the cause:
When the module gets searched using FindResource, is the correct HINSTANCE value passed across to the FindResource call. If this has been corrupted in your program then it could cause this problem.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
How do I know if it is corrupted? It seems a strangely even number: 0x00400000, every time, but is that wrong? And why is it set to that if it is wrong (it is the value assigned to the DLL in the DllMain routine).
/Daniel
|
|
|
|
|
The value you quoted for you HINSTANCE is typical for a loaded DLL, so it looks like thats not the problem.
The only other idea that occurs to me is that the resources are in the file, but they are in a different language section (You can have multiple resources for different languages in the same file, I think).
It may be worth checking in your .rc file that they are being compiled into the correct language space.
From one of my .rc files I have:
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
This may be missing or incorrect in the file to cause it to be in a different language area.
These are only guess's, I hope they help out.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
Thanks for your help!
This was indeed the problem. What had happened was that a few resources had entered the resource file that were in swedish (I'm Swedish, dontyaknow) and all the rest were set on US English (because in realy the *are* in English and not in Swedish). Therefore FindResource refused to load them, since there were multiple languages available.
Let this be a warning to ye all! Don't mix and match.
Three days of my life I wasted on this problem. Thanks again Roger Allen, you are my savior.
/Daniel
|
|
|
|
|
Daniel Hellsson wrote:
Thanks again Roger Allen, you are my savior.
Praise indeed
Glad to be of service.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
One interesting result of the "non-existance" of my resources was that my program crashed before it had started! :P I got an access violation in NTDLL.DLL which confused me no end. Luckily someone else here at work had experienced similar behaviour before and had traced it to resource issues.
Now I only have one really wierd problem left (which I won't deal with just yet) where a call to fprintf returns into a completely different place in the source than where it was called from. I have even pinpointed the exact moment in fprintf where the callstack changes, but I don't even know where to begin troubleshooting this one...
But, as I said, don't rack your brains, I'll deal with this problem later. I have more pressing issues here at work at the moment.
Keep on hackin'!
/Daniel
|
|
|
|
|
Daniel Hellsson wrote:
I have even pinpointed the exact moment in fprintf where the callstack changes
I would check the parameters being passed to the call to fprintf. If you have a mismatch between the type and the format specifier (%s,%f etc), then you could end up with lots of different types of problems.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
Hi
I'm using the normal socket calls (no MFC-Socket-classes) to send UDP telegrams ... It's working wonderful and I also managed to implement broadcast sendings/receivings.
Now I want to implement multicast but can't find somewhere a good documentation how to do that ... I hope someone here can help me, maybe with some source code or a good URL ... I would like to know what I have to do when I create the socket (for broadcast I needed to make a setctrlsocket to tell the socket that is can do some broadcasts ... is there something similar for multicast)??? I'm also wondering how to make these groups that I need ... after all I need to tell to which group of participations the multicast has to go and how to put some members in the group ... I'm also wondering how to make the sendto-call then ...
Please I really need some help with that... I didn't get any answers in the MSDN ...
Thanks
Grit
|
|
|
|
|
|
How can I retreive the IMac address of net board on NT4, 2000 and XP.
Thanks
elisabeth.sever@europlacer.fr
|
|
|
|
|
This is what I have been using on NT4 machines.
If you have say IIS running this fails due to not allowing the lan adapter to reset.
// requires Netapi32.lib for linking
CString GetTheMacAddress(int adapter_num)
{
CString mac_addr;
TRY // if the request has an invalid port it fails. Need to look for option for error test
{
// Reset the LAN adapter so that we can begin querying it
NCB Ncb; // requires Nb30.h header
memset(&Ncb, 0, sizeof(Ncb));
Ncb.ncb_command = NCBRESET;
Ncb.ncb_lana_num = adapter_num;
if (Netbios(&Ncb) != NRC_GOODRET)
{
mac_addr = "BAD (NCBRESET): ";
mac_addr += Ncb.ncb_retcode;
goto fail_mac;
}
// Prepare to get the adapter status block
memset(&Ncb,(char)0,sizeof(Ncb));
Ncb.ncb_command = NCBASTAT;
Ncb.ncb_lana_num = adapter_num;
strcpy((char *) Ncb.ncb_callname, "*");
struct ASTAT
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff[30];
} Adapter;
memset(&Adapter,(char)0,sizeof(Adapter));
Ncb.ncb_buffer = (unsigned char *)&Adapter;
Ncb.ncb_length = sizeof(Adapter);
// Get the adapter's info and, if this works, return it in standard,
// colon-delimited form.
if (Netbios(&Ncb) == 0)
{
mac_addr.Format("%02X%02X%02X%02X%02X%02X",
int (Adapter.adapt.adapter_address[0]),
int (Adapter.adapt.adapter_address[1]),
int (Adapter.adapt.adapter_address[2]),
int (Adapter.adapt.adapter_address[3]),
int (Adapter.adapt.adapter_address[4]),
int (Adapter.adapt.adapter_address[5]));
}
else
{
mac_addr = "BAD (NCBASTAT): ";
mac_addr += Ncb.ncb_retcode;
}
}
CATCH_ALL(e)
{
mac_addr = "BAD";
}
END_CATCH_ALL
fail_mac:
if(mac_addr.Left(3).Compare("BAD")==0)
{
mac_addr = GetTheComputerName();
mac_addr+="xxxxxxxxxxxx";
mac_addr = mac_addr.Left(12);
}
else if(mac_addr.Left(12).Compare("000000000000")==0)
{
mac_addr = GetTheComputerName();
mac_addr+="xxxxxxxxxxxx";
mac_addr = mac_addr.Left(12);
}
return mac_addr;
}
|
|
|
|
|
hi all,
I have a simple chat program that uses windows sockets...
The problem is if my chat server is behind a Proxy, then the clients are unable to connect to the server...
How can i establish connection between a remote client and my server which is behind the proxy...
Does 'HTTP Tunnelling' Help?? If yes, where can i get more info on it??
please help !!!
ananth
|
|
|
|
|
Here at CodeProject you can have a look at Alex Turc's article HTTP Tunneling.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi..
I have looked at the Alex Turc's HTTP Tunneling project... I think it would allow client applications to make connections to a remote host via a Proxy..
I want to know if this technique would also work for a Remote Client, trying to connect to a local host when there is a Proxy in between, that is a remote client wanting to initiate a connection to a local host?? Can proxy allow such a connection to take place???
regards
ananth
|
|
|
|
|
If what you're trying to do is connect to a remote host inside a local network, that network should have some form of NAT (Network Address Translation) installed to make the remote host (or some TCP ports of it) visible to the outside world. There are various NAT systems, but all of them work replacing public addresses with private ones. Sort of like a proxy, but at a TCP/IP level (i.e., the system is transparent to the endpoints of the connection). Look for NAT on your web searcher.
Generall, NAT systems are managed and configured by the network administrator, so if he hadn't made public the remote host you're trying to connect to, there's litle you can do from the outside.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|