|
Hi everybody
Is it possible to insert into an Active X Project an other active X?
Can you tell me about this?
dvlpt
|
|
|
|
|
From my application I open up a modless dialog. And when this dialog is closed the focus is NOT returned to the application. How can I fix that..
Anyone have any tips for me ?
|
|
|
|
|
You may possibly restore the focus manually:
void CMyModelessDlg::OnDestroy()<br />
{<br />
CWnd *pParent = GetParent();<br />
CDialog::OnDestroy();<br />
pParent->SetFocus();<br />
}
Of course your modeless dialog must be a child of the window that you want to refocus. You may also try AfxGetMainWnd()->SetFocus() otherwise.
Regards,
BB
|
|
|
|
|
Hello!
I need to move a modeless dialog over a specific control from the parent window! (On the parent window resource, I draw a picture wich will be covered by the new modeless window).
The problem is that the MoveWindow function is relative to the upper-left corner of the parent window’s client area and the GetWindowRect is in screen coordinate !!!!
Can someone help me?
Thanks!
|
|
|
|
|
I found the ScreenToClient function !
|
|
|
|
|
Hi, everyone!
I find the samples on MSDN is not very clear and
the documents are not sufficient. Where can I find
I tutorial about this topic?
regards,
George
|
|
|
|
|
Does this help:
http://www.gotw.ca/publications/using_auto_ptr_effectively.htm
|
|
|
|
|
Thanks, Xander80 buddy!
George
|
|
|
|
|
Hi, everyone!
What means "smart pointer"? Where can I find some
online materials to refer?
Thanks in advance,
George
|
|
|
|
|
smart pointer is a class that wraps a pointer and overloads operator -> , to enable clients to use the smart pointer with same syntax as regular pointer. the class takes care of lifetime of the wrapped object (e.g. reference counting for COM objects, or deallocation for regular pointers).
Example:
void fn()
{
std::auto_ptr<CMyClass> pMyClass = new CMyClass();
pMyClass->SomeFunction();
}
some examples:
std::auto_ptr<> - check MSDN library
_com_ptr_t<> - wraps COM objects, VC++ compiler supported (check MSDN library)
CComPtr<> - wraps COM objects, provided by MFC (check MSDN library)
also, check Boost[^] for few other implementations
|
|
|
|
|
Thanks, Zed buddy!
George
|
|
|
|
|
Hi,
I have created a Deskband in internet Explorer and it is working fine. My Deskband contains two COM objects (designed by me and they are also doing fine). The problem i am facing is that if i right click a link in IE window, while my Deskband is selected, and click on "Open in New Window", then my Deskband also shows up in the new pane but it doesn't contain anything.
Please suggest me what to do!
regards,
|
|
|
|
|
Hello,
I'd like to create a toolbar (docked) with a width of 2 columns. I've searched newsgroups and the web, and all I can find is a way to set a CPaletteBar's width, via:
m_wndPaletteBar.SetColumns(AfxGetApp()->GetProfileInt(_T("General"),_T("Columns"),3));
I'd like to stick to a toolbar though - can it be done?
I'd like it to look like the paint program that comes with windows.
Also, when you pick the brush tool in Paint - you get a choice of brushes, I guess this is using a CDialogBar, but which control is it using?
Many thanks,
Josh
|
|
|
|
|
Dear Friends
My application which is in WINAPI doesn`t support 24bit color screen.it is wokring for all other options like 32 bit,256color etc.In 24 bit mode, I am getting garbled picture.
Kindly write to me how to solve it.
Thanking you.
Adarsh
|
|
|
|
|
I'm writing an unistaller and I want it to delete itself when all work is done. I tried to start a new tread but it finishes when the app exits. I need to ask the system to do the deletion. Can give me a solution how to do this or how to make the uninstaller if you have any other ideas.
|
|
|
|
|
|
There is an MSDN article about this (though I forget the title or KB number.) IF you search you'll find it.
But the most reliable, cross-platform way to do it is for the EXE to create and spawn a batch file that deletes it. The batch file will do something like this:
:deleteme
del program.exe
if exist program.exe goto deleteme
del thisbatchfile.bat
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Dear Friends
My application doesn`t support 24bit color screen.it is wokring for all other options like 32 bit,256color etc.In 24 bit mode, I am getting garbled picture.
Kindly write to me how to solve it.
Thanking you.
Adarsh
|
|
|
|
|
When reading (or writing) through your bitmap data, you have to remember that each scan line is DWORD aligned. So when you reach the end of a scan line, you will have to realign your pointer to the next DWORD boundary. If you do not do this, you will get the garbage at the end of each scan line mixed into your data, causing the picture to appear messed up.
This code is from my PJAImage class and converts a 24bit bitmap to greyscale
else if (bm.bmBitsPixel == 24)
{
BYTE *dst=(BYTE*)pBits;
for (int dh = 0; dh < bm.bmHeight; dh++)
{
for (int dw = 0; dw < bm.bmWidth; dw++)
{
dst += 3;
}
int pos = (int)dst - (int)pBits;
int rem = pos % 4;
if (rem)
dst += 4 - rem;
}
} HTH
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Dear PJ Arends,
In my code they have not used any class.It`s in WinAPI, as I am doing customization.
My progrmacode is like this:
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
hmemdc = CreateCompatibleDC(hdc);
hBmp = CreateCompatibleBitmap(hdc, WND_WIDTH, WND_HEIGHT);
SelectObject(hmemdc, hBmp);
hmemdc1 = CreateCompatibleDC(hdc);
SelectObject(hmemdc1, hBmpBckgnd);
StretchBlt(
hmemdc,
0,
0,
WND_WIDTH,
WND_HEIGHT,
hmemdc1,
0,
0,
1,
1,
SRCCOPY);
DeleteDC(hmemdc1);
This code has problem with 24bit screen resolution.What is needed...
Kindly let me know...
Thanking You.
AD
|
|
|
|
|
Other than a resource leak (you do not restore hmemdc1 before you delete it) I see nothing here that would break when using 24bit colour and would work with other colour settings. The only thing I can think of is that the bBmpBckgnd bitmap is corrupted before it gets to this point.
Check out http://www.codeproject.com/tools/imageviewer.asp[^]. It is a tool that I wrote so that I could check out these types of things in my own code. You can use it to check out what is contained in all your memory device contexts and bitmaps at any point in your code.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hello!!
I have a program that shows a message box from a dll (in fact it's not a complete messagebox but a wnd that is a child of another window of my program).
When I call the function, I have a runtime error that says that the caling convention of the function from the dll is not corret. Here is the code:
In the program:
typedef void (WINAPI *SHOWTOOLDLG)(int, CRect,CWnd*);<br />
...<br />
...<br />
...<br />
void SomeDlgClass:OnSomeEvent()<br />
{ <br />
if (m_hToolDll)<br />
{<br />
SHOWTOOLDLG m_pShowDlg_Func = (SHOWTOOLDLG)GetProcAddress (m_hToolDll,"ShowToolDlg");<br />
if (m_pShowDlg_Func)<br />
m_pShowDlg_Func(0,ClientRect,this);<br />
}<br />
}<br />
in the dll:
extern "C" __declspec(dllexport) void ShowToolDlg(int ToolId, CRect Position,CWnd* pParent)<br />
{<br />
CToolConfDlg* Win;<br />
Win = new CToolConfDlg;<br />
Win->Create(IDD_EMPTYDLG,pParent);<br />
Win->ShowWindow(SW_SHOW);<br />
}
Could someone help me ??
Thanks!
|
|
|
|
|
1. Why extern "C" ?
2. If it is a regular DLL using MFC, you need to add:
AFX_MANAGE_STATE(AfxGetStaticModuleState());
at the beginning of your DLL-exported function.
Regards,
BB
|
|
|
|
|
After initializing the timer by:
SetTimer(ID_PLAYTIME_EVENT, 1000, NULL);
The following codes will result in exception: 0XC00000FD: stack overflow?
void CCPPPLAYERDlg::OnTimer (UINT nIDEvent)
{
MSG msg={0};
switch (nIDEvent) {
case ID_PLAYTIME_EVENT:
if(g_hwndMain)
{
// Main message loop
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg); DispatchMessage(&msg);
}
break;
}
CDialog::OnTimer(nIDEvent);
}
DJ
|
|
|
|
|
Don't put such a loop into a timer function. They were not designed to co-exist. The code you put into a timer function must be short, sweet and to the point, consuming as little CPU as possible.
|
|
|
|