|
|
You might also want to check out ReadDirectoryChangesW() and FindFirstChangeNotification() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have put this question before but it was misunderstood.
I need to declare a pointer to MFC class CMyView in CMyDialog but including myview.h in mydialog.h leads to errors (propably because mydialog.h is also included in myview.h).
Any solutions ?
|
|
|
|
|
Do not include myview.h in mydialog.h.
Put the following line right before your class definition for CMyDialog:
class CMyView;
And include myview.h in your cpp file after the include for mydialog.h.
John
|
|
|
|
|
Use forward declaration of a class. For example:
class CMyView;<br />
class CMyDialog<br />
{<br />
CMyView *m_pView;<br />
};<br />
.<br />
.<br />
.<br />
class CMyView<br />
{<br />
};
That works.
|
|
|
|
|
Do you really need to declare a pointer to CMyView or will a pointer to a CView suffice? Remember, you can always cast the pointer to a CMyView* in MyDialog.cpp .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi there,
How can I set the main applicatin window to a certain size at startup? With the code below, it sizes to the set size only when the Restore button is clicked. I'd like it to be that size when the application starts up. How can I manage this? Thanks!
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style =
WS_OVERLAPPED | WS_CAPTION |
WS_THICKFRAME | WS_SYSMENU |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
cs.cx = 1000;
cs.cy = 800;
cs.x = 100;
cs.y = 100;
return CMDIFrameWnd::PreCreateWindow(cs);
}
|
|
|
|
|
Use the following Cwnd function,
BOOL SetWindowPos(
const CWnd* pWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT nFlags
);
Do a search on this fcn in msdn to find out more.
|
|
|
|
|
This function is only for child windows and popups. How can I size the main window not the child window? Thanks.
|
|
|
|
|
Have you tryed it? It's always worked for me. If you go on MSDN, the actual description is:
"Call this member function to change the size, position, and Z-order of child, pop-up, and top-level windows."
Also, make sure you put this in the OnCreate fcn.
|
|
|
|
|
You can do that by handlling [WM_GETMINMAXINFO] message too!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello everybody, I hope someone can help me with this problem, i have tried a failed miserably.
I have a client/server app, each machine will have 2 LAN adapters (one for stream data at high rates and the other for control). The underling protocol is UDP. So in order to implement a response mechanism I use the sender address returned as an output parameter from the receivefrom() function. When working with 2 different PC there is no problem (both of them with 2 lan adap), the problem appears when I tried to run the apps in my developing machine to test one of the protocols, recivefrom() returns the address of the adapter listening, not the address of the sender… so I can’t acknowledge the packet send.
Does anybody has experienced this kind of problem, or something related? Is there any sockopt() that I can use? OS configuration? (by the way this runs in win2k).
Thank you all.
"I don't want to achieve immortality through my work... I want to achieve it through not dying."
Woody Allen
|
|
|
|
|
if you're testing client and server apps on the same machine then you will get problems, cos u cant create 2 udp sockets on the same port.
|
|
|
|
|
I need to access MFC view class from modeless dialog class.
Is it possible ?How
|
|
|
|
|
the easiest way is to just give that dialog a pointer to the view you want to access.
theDialog->m_pView = pPointerToViewObject;
or, if you want the dialog to access the active view, you can use AfxGetMainWnd and CFrameWnd::GetActiveView to find it.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
depends if you hace SDI or MDI.
if is MDI:
// this is from MSDN Library
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
// Get the active MDI child window.
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
// Get the active view attached to the active MDI child
// window.
CMyView *pView = (CMyView *) pChild->GetActiveView();
if is SDI:
CFrameWnd* pMainFrm = (CFrameWnd*)AfxGetMainWnd();
CMyView *pView = (CMyView *)pMainFrm->GetActiveView();
Once you have pView you can call functions or send messages.
"I don't want to achieve immortality through my work... I want to achieve it through not dying."
Woody Allen
|
|
|
|
|
I have thought about something of the kind myself before posting on codeproject.I used CWnd::GetParent and tried to cast CWnd to CMyView .But to my big dissapointment I found out that including MyView.h in MyDialog.h leads to a lot of errors.
The problem persists with your code.To declare CMyView in my dialog class I have to include MyView.h in MyDialog.h and that leads to errors.
|
|
|
|
|
|
Hi,
I have a DLL that I cannot lay hand on the source code. The dll is having decorated names. Please how can I call/link to the functions inside the dll without using the decorated names? Or how do I call/link the functions inside the dll with the decorated names?
|
|
|
|
|
Calling the decorated names should be as simple as GetProcAddress to get the function pointer, then calling through the pointer. Do you have the function parameter signatures and usage instructions? Could get messy if you don't.
|
|
|
|
|
cpm2,
The dll contains the function in the form
int __cdecl tt(char const *,char const *,char const *)
and have mangled name of the form
?tt@@YAHPBDH0@Z (using dumpbin)
Can you give me a short code to do as you suggested please? I am not used to the LoadLibrary/GetProcAddress thing.
|
|
|
|
|
Here a small sample:
<br />
<br />
typedef UINT (__cdecl *LPFNDLLFUNC)(int, int);<br />
<br />
HINSTANCE hDLL;
LPFNDLLFUNC DllFunction;
<br />
<br />
<br />
hDLL = LoadLibrary(DLLName);<br />
int iLastError = GetLastError();<br />
if (hDLL != NULL)<br />
{<br />
DllFunction = (LPFNDLLFUNC)GetProcAddress(hDLL,FunctionName);
if (!DllFunction )<br />
{<br />
MessageBox(NULL,"Error initalising function!","",NULL);<br />
FreeLibrary(hDLL); <br />
}<br />
else<br />
{<br />
UINT test;<br />
test = DllFunction(10,20);
<br />
}<br />
}<br />
else<br />
MessageBox(NULL,"Error initalising DLL",NULL);<<br />
I hope I've helped you...
|
|
|
|
|
Hi Guys,
Could anyone tell me how to wrap an activex control and have it as a "nice" .NET control? I know about AxImp.exe and the RCW, but they are not what I really want. I would like to know how Microsoft wraps the TreeView, ListView or the other controls, so that the types of all the properties and methods are like as if they were native types.
The classes that eg. the TreeView control uses are native .NET classes, but I don't understand how types, such as TreeViewNode converted to some native type that the activex control uses.
I tried to use Reflector to see what's going on behind the scenes, but apart from some SendMessage() calls, I couldn't find anything.
Answers are most welcome.
Tamas
|
|
|
|
|
Hi everyone,
My question is how to copy files from one computer to another through local network?
I want to copy files from my visual C++ program to another computer through local network. I knew I can use socket to make clint and server program to do that. But for my case on the clint side do not do anything just to receive files. Can anyone tell me any simplest way to do that?
Thank you.
|
|
|
|
|
Share a folder from the remote machine?
|
|
|
|