|
|
Hey Friends
I Want To Enumerate (Precisely Get the Handle Of CMDiChild 's )Opened at a Particular Instance.
Help!
|
|
|
|
|
What you can do is loop through all of the documents and for each document, loop through all of the open views:
CWinApp *pApp = AfxGetApp();
POSITION pPos = pApp->m_pDocManager->GetFirstDocTemplatePosition();
while (pPos)
{
CDocTemplate *pTemplate = pApp->GetNextDocTemplate(pPos);
if (pTemplate)
{
POSITION pDocPos = pTemplate->GetFirstDocPosition();
while (pDocPos)
{
CDocument *pDoc = pTemplate->GetNextDoc(pDocPos);
if (pDoc)
{
POSITION pViewPos = pDoc->GetFirstViewPosition();
while (pViewPos)
{
CView *pView = pDoc->GetNextView(pViewPos);
if (pView)
{
CFrameWnd* pFrame = pView->GetParentFrame();
... and your code goes here!
}
}
}
}
}
}
|
|
|
|
|
I have a Single Doc app and want to put a border around the inside of it.
Thanks,
graham
|
|
|
|
|
When drawing inside your client area: 1) Draw your inside boarder, 2) use ExcludeClipRect() to exclude the border area from further drawing, 3) then use the mapping functions set the upper left and lower right courners of the new rectangular area where you wish all your normal drawing to occur, 4) draw like you normaly would.
I recomend you get a copy of "Programming Windows" by Charles Petzold, in order to figure out how to use the mapping functions. Also, try looking at the CDC methods and do a search of the MSDN Library using the names of the functions in the mapping section.
Trust in the code Luke. Yea right!
|
|
|
|
|
Hello,
I have a problem with DLLs again
I have to load two DLLs which each contain 3 functions. The first function has to be called one time, the second very often, and the third only one time.
Now I call the second function about 60000 (each DLL) and I get a stack overflow???
The DLL function is:
DLL_C_EXPORT unsigned long gdPlay(unsigned long uRound, unsigned long uEnemyLast)
{
return (unsigned long)(rand() % 2);
} The calling loop in the main project is:
for(dwRound = 0; dwRound < m_dwRounds; dwRound++)
{
dwCurrent1 = lpDllPlay1(dwRound, dwLast2);
dwCurrent2 = lpDllPlay2(dwRound, dwLast1);
if((dwCurrent1 == 1) && (dwCurrent2 == 1))
{
dwPoints += m_dwPoints11;
}
if((dwCurrent1 == 1) && (dwCurrent2 == 0))
{
dwPoints += m_dwPoints10;
}
if((dwCurrent1 == 0) && (dwCurrent2 == 1))
{
dwPoints += m_dwPoints01;
}
if((dwCurrent1 == 0) && (dwCurrent2 == 0))
{
dwPoints += m_dwPoints00;
}
dwLast1 = dwCurrent1;
dwLast2 = dwCurrent2;
} The DLL is loaded perfectly and it also returns the correct values (I checked it with MessageBoxes)... But after some calls (about 60000 each) there is the stack overflow...
Do you have any idea what could cause the stack overflow???
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
If the calling convention (stdcall etc) isn't correct in the call to the DLL function that might explain it. ie. who is responsible for popping params off of the stack.
|
|
|
|
|
I don't know why this came up as Anonymous - it was ME.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hmm, how would that look?
Shall I put __stdcall or __cdecl before all functions?
In the main program I defined the function like this:
extern "C"
{
typedef VOID(WINAPI *LPDLL_VOID)(VOID);
typedef DWORD(WINAPI *LPDLL_2UL_1)(unsigned long uRound, unsigned long uEnemyLast);
typedef DWORD(WINAPI *LPDLL_2UL_2)(unsigned long uRound, unsigned long uEnemyLast);
} How would that look now?
Thanks for your help, you seem to be the DLL expert
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Now it works!! I've replaced the WINAPI declaration (=__stdcall) with __cdecl and now everything works fine!
Thank you VERY much!
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
Now it works!! I've replaced the WINAPI declaration (=__stdcall) with __cdecl and now everything works fine!
Thank you VERY much!
Glad I was able to point you in the right direction. It would be interesting to know if this was related to your earlier problem of the DLL unloading and if putting the code optimization back how it was worked!
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I enabled the code optimization again and tried it... the program doesn't crash any more with optimization turned on... so it seems these problems were related somehow.
You were right from the beginning, that code optimization cannot be the source of the problem...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Dominik Reichl wrote:
You were right from the beginning, that code optimization cannot be the source of the problem...
This really didn't sound right, which is why I nagged you a bit. Put it down to experience. Good to hear all the problems have been resolved.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I am doing an application using TAPI32.lib.I have to capture the incoming call number.I have PCTel modem.AT#CID=1 command also working fine.I ahve down loaded caller ID applications and run,but they will not showing caller ID.My phone line has caller ID service.what is the caller ID system in India.
Anybody please kindly let me get rid of this problem.
yakkalas
|
|
|
|
|
I am also searching for the same, if you get any solution please let me know also..
Thanks in advance
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
Hi what i want to accomplish is this:
To transfer a file from one folder to another folder without having to do that manually. ie. open both folders and drag and drop, or copy and paste.
What i want is to have a very basic console program or win based but preferably console based, that exists in the folder with the file and i just want to be able to drop the file on top of the console icon and for it to be sent to the destination folder.
I need almost no user input just to drop the file on top of the icon to run the program to send the file to its destination folder.
Anyone have anyi deas how i would go about doing this.
im using VC++.NET environ.
kind regards
Dave Long
|
|
|
|
|
Have a look at WM_DROPFILES. I haven't done much with console apps, but this is what you use in a Windows app. Also CWnd::OnDropFiles(). This is what I use in ED (see sig) if the user drops a file on it, whether it is running or not. Hope that helps.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
IMO you will need a winapp to do this.
A very easy way to do this is :
Make a batch file (like the following, just replace [destination path] with your path.)
@echo off
if "%1" == "" goto end
if not exist %1 goto end
copy %1 [destination path]
:end
Put the batch file (name it mycopy.bat) iy your windows SendTo directory.
Now every time you want to copy a file, right-click on it, go in the SendTo submenu and click on mycopy.bat. Your file will be copied.
~RaGE();
|
|
|
|
|
Hi
Need to convert a DWORD to a CString
and a CString to a DWORD type.
Hope someone knows
Greetings
Jens
|
|
|
|
|
Hi,
converting a CString into DWORD means, u are going to covert integer to char
here is example.
#define HELLO 100
DWORD dwrd=HELLO;
CString str1;
char str[10];
str1=itoa(HELLO,str,10);
//CString str1=str;
AfxMessageBox(str1);
this will convert the DWORD into CString,but it is not wise.You can't get CString value like "HELLO". it is not possible i think.you can get 100 as a CString value.
yakkalas
|
|
|
|
|
DWORD is also an unsigned integer,trying to convert it into CString means converting integer to char.
Here I am sending simple Ex.
DWORD dwrd=HELLO;
CString str1;
char str[10];
str1=::itoa(HELLO,str,10);
//CString str1=str;
AfxMessageBox(str1);
This simple code will show u 100 not HELLO.So as I am thinking,it is not possible.
You mean to try to get CString value as HELLO?
if so it is not possible as per my knowledge.
yakkalas.
|
|
|
|
|
DWORD is also an unsigned integer,trying to convert it into CString means converting integer to char.
Here I am sending simple Ex.
#define HELLO 100
DWORD dwrd=HELLO;
CString str1;
char str[10];
str1=::itoa(HELLO,str,10);
//CString str1=str;
AfxMessageBox(str1);
This simple code will show u 100 not HELLO.So as I am thinking,it is not possible.
You mean to try to get CString value as HELLO?
if so it is not possible as per my knowledge.
yakkalas.
|
|
|
|
|
Well, it's like this i wanted:
I got a CString strValue = "5";
But i got a function which only accepts DWORD values;
so instead of CString strValue = "5";
It need to be converted to:
DWORD dvalue = 5;
that's all to it actually.
|
|
|
|
|
CString strValue="5";
DWORD dValue=atoi(strValue);
then dValue contains what is the value in strValue.
dValue=5;
yakkalas
|
|
|
|
|