|
The listener needs to catch messages comming from multiple ports, and this part has been working for quite a while.
The architecture is not standard, and this is probably confusing. The sender, and the listener are in separate threads, and don't really interact with eachother.
I guess than main question is:
What happens when you bind a socket to INADDR_ANY, and port 0 (meaning all ports), and when you have another socket bound to 10.3.2.1, and port 0?
In this case does the first socket still rcv messages sent to 10.3.2.1, or are they going to be directed to the second socket, since it is more specific? To confuse things even more, what happens when I close the second socket? It looks like any messages will get returned a Destination Port Unreachable error message (ICMP).
Thanks for your reply.
|
|
|
|
|
I'm working in an ActiveX and I'm trying to load a Menú using CMenu.LoadMenu.
The problem is that AfxGetResouceHandle returns NULL and I have no idea why. Can anyone help me ??
|
|
|
|
|
I have solved the problem, I add this line
AFX_MANAGE_STATE(AfxGetStaticModuleState())
|
|
|
|
|
Two things:
1.At design time, how do I make certain toolbar buttons invisible (I dont want to delete them in case I need them later)
2. How do I dynamically make a toolabr buton invisible at runtime? What code do I need. I tried:
void CFormViewMDIView::OnToolbarup()
{
GetDlgItem(ID_TOOLBARDOWN)->ShowWindow(SW_HIDE);
}
but it crashed.
Thanks for the help,
ns
|
|
|
|
|
First, check this FAQ
Then, try this (I´ve already posted that once, but i am still not sure it works)
Create a CtoolbarCtrl object, assign it the return value of pBar->GetToolbarCtrl where pBar is a *Ctoolbar . Then you have access to the EnableButton() and other functions of the same kind using the CtoolbarCtrl .
Just tell me if it works ...
~RaGE();
|
|
|
|
|
m_pToolBar->GetToolBarCtrl().HideButton(ID_TOOLBARDOWN, TRUE);
Where m_pToolBar is a pointer to a CToolBar object, and ID_TOOLBARDOWN is the ID of the button you wish to hide.
--------
PMGRE --Shog9 --
|
|
|
|
|
Thank you. I'll try it. Much appreciation,
ns
|
|
|
|
|
It compiles fine, but crashes when I press the button that executes this snippet:
void CTrain1View::OnToolbarup()
{
//AfxMessageBox("Up pressed");
CToolBar * m_pToolBar;
m_pToolBar = (CToolBar*)GetDlgItem(IDR_MAINFRAME);
m_pToolBar->GetToolBarCtrl().HideButton(ID_TOOLBARDOWN, TRUE);
What am I doing wrong?
Error is memory couldnt be read...
|
|
|
|
|
The toolbar is *not* a child of the view, so the line
m_pToolBar = (CToolBar*)GetDlgItem(IDR_MAINFRAME); isn't going to work. If you used the app wizard to start your program, the CMainFrame class will have a member m_wndToolBar that is the toolbar. You can create an access method for this, or just put your code in CMainFrame to start with (if it's only purpose is doing stuff to toolbars, it probably belongs there anyway).
--------
PMGRE --Shog9 --
|
|
|
|
|
WHat are the special things to be done to make the toolabr button and a corresponding menu item both run the same code? Would one give the same ID to both the button and the menu item? Is that legal?
Thanks,
ns
|
|
|
|
|
ns wrote:
Would one give the same ID to both the button and the menu item?
Yes.
ns wrote:
Is that legal?
Yes.
--------
PMGRE --Shog9 --
|
|
|
|
|
That worked. I tried making a getToolbar() public method in mainframe returning the toolbar object created in CMAinFrame, but it said no copy constructot available. SO I'll put my code in the frame class, though theres data involved that I'm not sure the frame needs to know about...
Thanks a million,
ns
|
|
|
|
|
I have a 3rd party library that shipped with only the DLL itelf and a header file with function prototypes and constants. All the procedures inside the DLL are declared using the dllimport keyword. Does this mean that I can't dynamically link into this DLL at runtime because none of the functions were exported? I've already written an app that links to this DLL statically, and that works fine, but I'd rather use dynamic linking.
Everything I've read so far points me to the fact that since there isn't a .DEF file, and the functions aren't declared using dllexport, I can't dynamically link to this library. Am I right?
Thanks guys...
-Mike Zinni
email: mzinni@rimail.com
AIM: zin9999
|
|
|
|
|
Do you have a lib file? You should be able to link with it.
Best regards,
Alexandru Savescu
|
|
|
|
|
Yes. I have the .LIB file and the directory is included in my Tools->Options->Directories->Library files settings. I wrote the following code to link to the DLL.
typedef int (CALLBACK* LPOMNICREATEFUNC)(void);
BOOL COmniDoc::LoadOmniLibrary()
{
m_bOmniLoaded = FALSE;
m_hOmniLibrary = LoadLibrary("SD2.dll");
if(m_hOmniLibrary)
{
m_bOmniLoaded = TRUE;
m_lpfnSD_Create = (LPOMNICREATEFUNC)GetProcAddress(m_hOmniLibrary, "SD_Create");
}
return m_bOmniLoaded;
}
m_lpfnSD_Create is of type LPOMNICREATEFUNC.
LoadLibrary returns a valid handle, but the m_hlpfnSD_Create variable is set to NULL after the call to GetProcAddress...
-Mike Zinni
email: mzinni@rimail.com
AIM: zin9999
|
|
|
|
|
OK. Made some progress. I used the Depends tool that comes w/ VC++ and found out that the names of the exported functions are all messed up. That "SD_Create" procedure is actually exported as "_SD_Create@0". Now I'm at least returning a valid function pointer.
Is there any particular reason that the name is changed like that? And secondly, if I didn't use the Depends tool, how in the HELL was I ever supposed to come up with that?
-Mike Zinni
email: mzinni@rimail.com
AIM: zin9999
|
|
|
|
|
mikez99 wrote:
found out that the names of the exported functions are all messed up. That "SD_Create" procedure is actually exported as "_SD_Create@0".
That's not messed up, that's the usual name mangling taking place for PASCAL (aka __stdcall) calling convention functions.
|
|
|
|
|
No, thats not name mangling for C-style __stdcall calling convention, but is the name mangling of the C++ compiler (so called "decorated names").
The reason for this is that C++ supports overloading, but at link time every function identifier needs to be unique. So the C+++ compiler codes the numer and types of the functions arguments into the name and links against this name. The @0 in you case indicates a function without arguments.
Note that decorated names are always used if the functions are exported with __declspec(dllexport).
If possible you should link against the .lib file and so implictly load your DLL. You may also use the VC6 and above delay load feature.
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Why do I get an access violation when I try to get the value of the iterator "it" in this piece of code? When I look at the iterators they have no valid pointers to the strings.
typedef vector<CString*> TFileList;
typedef TFileList::iterator TFileListIt;
CStringList strlistFiles;
fsDlg.SelectFile(&strlistFiles);
int nFiles = strlistFiles.GetCount();
if (nFiles > 0)
{
int nIndex;
TFileList FileList(nFiles);
CString strFileName, strNewFileName;
POSITION pos;
for (nIndex = 0; nIndex < nFiles; nIndex++)
{
pos = strlistFiles.FindIndex(nIndex);
FileList.push_back(&strlistFiles.GetAt(pos));
}
TFileListIt start, end, it;
start = FileList.begin();
end = FileList.end();
for (it = start; it != end; it++)
{
TRACE("> %s\n", **it);
}
}
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Try *(*it)? (Just guessing ).
Best regards,
Alexandru Savescu
|
|
|
|
|
The problem is that my vector seems to be empty, even though I am filling it with valid pointers.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Did you call size() to see if it is empty?
Best regards,
Alexandru Savescu
|
|
|
|
|
size() returns 8, but I have added 4 pointers to the vector.
I have noticed that the vector elements does not point to m_pchData of the string list elements I am using, but to some other address.
_First and _Last of the vector are updated when adding to the vector.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|