|
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?
|
|
|
|
|
To make a share folder is no problem but if the program running on 50 computer at the same time and all need copy files to this remote machine can this be done?
Do I use this remote machine's name to do the copy? and How?
Thank you.
|
|
|
|
|
Take a look at the documentation for CopyFile() and CopyFileEx() in the Platform SDK. You would use "\\computer-name\path\filename" for the destination (the path would be the folder share name).
Steve
|
|
|
|
|
Hey,
I have a SDI application with a simple view class. This class use a non modal dialog (the dialoge is as large as the viewwindow) to receive user inputs. Now I need a solution to prevent resizing when main window is smaller then the dialog (width).
many thanks for helping me
|
|
|
|
|
See WM_SIZING or WM_GETMINMAXINFO .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
but how can I set a minimum width (e.g. when cx has a minimum size of 1024px not more resizing is allowed).
I used WM_SIZE before in order to move the dialog...
|
|
|
|
|
|
Hello,
Somebody can help me in my client/server applicationme because i want to get the user of the session of windows, but i know in the client and i can send to the server,but i dont know how can the server can know the window's user?, Existes something to the server to know the window's user of the client when the client stablish a communication with the server sending the IP, port,...
Or better, somebody know how can i get the window's user of one computer but without the function GetUserName?.
Thanks a lot
Hej.
|
|
|
|
|
look for NET* prefix functions!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi world,
My question is simple:
How can I write file with a sequencial access type?
I want this to accelerate the writing bandwidth of my HD.
With a litle application (not open source) I obtain:
- For a random writing access, my HD bandwidth is 5 MB/sec
- For a sequencial writing access, 15 MB/sec
Thanks for all answers...
Hello World!!!
from Raphaël
|
|
|
|
|
|
Thanks a lot for this solution... I will test that now...
Hello World!!!
from Raphaël
|
|
|
|
|
Is there a way my app can get the path of files dropped from it?
Example... The user drags the file "test.txt" from my app into windows explorer... can I retrieve the path the file was dropped into?
I'm using OnBegindragFilelistbox function to begin the drag process and a COleDataSource to implement the procedure.
Thanks in advance.
|
|
|
|
|
Use SHChangeNotifyRegister a window for retrieve all Events and all entries, and DoDragDrop a unique tmp file, then when the window retrieve SHCNE_CREATE, if the filepath inclue the unique tmp file, then the path is your request.
|
|
|
|
|
Hi all,
I am getting problems with my code in Release mode.because this one works in debug mode.
I had read all the articles here and even then i'm unable to solve my problem.
Always my application crahses after I reach this function in release version.
func(start,&count,&ipbytes,0,&returnbuff,compid)
here :
start value starts from 0 and go on increments
count is always 1
ipbytes will receive some data and I initialized it with 0 inside the function
returnbuffer also receives some data to store.
id is also a constant value.
My program in release version crashes at this function and says "Access Violation:Integer divide by zero".But no problem in debug mode.
I gave all the values in the function as 1(ie non-zero).Even then i am getting the same problem.
Can anyone suggest me the solution?
|
|
|
|