|
Hi,
CDC dc;
dc.Attach (pInfo->m_pPD->GetPrinterDC ());
pInfo->m_pPD->m_pd.hDC = dc.GetSafeHdc ();
does nothing, the return is 0x000000. I think it is because I have overriden the CMyPrintDialog::OnOK () and then is not making the things it should. Because of that I asked at the beggining of the post, where can I find the implementation of the Windows-CPrintDialog?? I have searched in my VC++ folder but I have only found the definitions in one .h but there is no .cpp for it.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
If you like you can send your program for me,if I can find problem I send answer for you.
|
|
|
|
|
Not problem I hope you write your program early if you have question you can ask it
|
|
|
|
|
|
Hey friends,
I m trying to read a file which in encoded with unicode encoding, i hav to extract some information from it to proceed with my job.
Is there any MFC to read it ?
So enybody can help me in doing it.
Thank You
Regards,
Pankaj Sachdeva
|
|
|
|
|
|
Still using VC6 with MFC 4.2.
I have a dialog, built with the dialog editor. This dialog contains a tab control among others.
I would like to change the size of this tab control before it is initially displayed.
As all my questions it sounds harmless but is not (unless I made a really stupid mistake, what I reserve the right for ).
First I tried PreCreateWindow. Not called. Then I thought maybe PreCreateWindow works only for non controls (frame windows, MDI windows and stuff) and tried to override the CTaCtrl::Create. Nada.
Then I thought maybe the CWnd::CreateEx is used, since the TabControl is a child window.
No success. I even tried sophisticated things like making a WM_INITIALUPDATE handler. But my functions get never called.
Until now I did not figure out where the tab control is created. On the one hand there is the dialog created from the resource but this really concerns only the dialog window itself. On the other hand in OnInit the WM_INITIALUPDATE is sent to the children. So they must have been created before.
So answers of both kinds are welcome:
*) How do I intercept
*) Where are controls initiated
Ofcourse links to articels are also welcome (you don't have to write a book size explanation youself). Maybe you know just the magic key words for the search .
Kind regards
Leo
|
|
|
|
|
I would like to change the size of this tab control before it is initially displayed.
WM_INITDIALOG [OnInitDialog]. Call CTabCtrl::SetWindowPos with the desired position coordinates.
*) How do I intercept
*) Where are controls initiated
Child windows are created by MFC framework inside their parent window's WM_CREATE handler.
--
=====
Arman
|
|
|
|
|
That's what I feared.
But I want to encapsulate the behaviour in my class derived from CTabCtrl (just select the derived class instead of the CTabCtrl class when attaching the tab control in the class wizard).
So the only work around that comes in to my mind is to change the window size in the OnPaint function. Not very elegant.
Actually I still did not find the place where the child windows are created (I have not much time to search, too). But it could also be inside the DDX_Control function (which is called inside the OnInitDialog function). At least the MFC class is attached to the window there (no wonder, it's the only place in code, where an assignment between control (ID) and MFC class/Variable takes place).
For now I will impleement the work around since there seems not to be a creation hook by design.
Probably when I ride home by train I can also take a second look what OnInitDialog really does.
Thx
Leo
|
|
|
|
|
Iam new to VC++ and thought of purchasing an Book... As i was seraching i came to know abt various versions
1)VC++ 2005
2)VC++.net
3) Visual Studio
CAn any one please tell me what these versions are ... and for which one i have to go,, that will help my future as well..
plz suggest me a good book for study..
Proud To Be an Indian
|
|
|
|
|
The versions go:
Visual Studio 6
Visual Studio.Net
Visual Studio.Net 2003
Visual Studio 2005
Which version do you have access to? If you don't have the full VS, you can get the Express C++ IDE (based off VS 2005) from MS for free.
|
|
|
|
|
Visual Studio 6 --> VC++ 6.0
Visual Studio.Net --> VC++ 7.0
Visual Studio.Net 2003 --> VC++ 7.1 (i'm not certaint about this one)
Visual Studio 2005 --> VC++ 8.0
I think the Visual Studio 2005 Express is without the MFC libraries.
codito ergo sum
|
|
|
|
|
SO if i go for Visual studio .net 2003 will it be useful.
Proud To Be an Indian
|
|
|
|
|
See this[^] thread is helpfuls?
|
|
|
|
|
this is my test code, it runs good on my computer, but on other computer , can not see the progress dialog,why ?:
(Are there any other methods to show a progress dialog to a no window procedure except multithread?)
////////////////////////////////////////////////////////////////////////////
#include <windows.h>
#include <process.h>
#include <commctrl.h>
#include "resource.h"
/*-------------------------------------------------------------------------*/
#define WM_PROGRESS WM_USER+1
typedef struct
{
HWND hDlg;
HWND hProgress;
HINSTANCE hInst;
}MyParams, *ptMyParams;
/*-----------------------------------------------------------------------*/
BOOL CALLBACK MyDlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
void Thread1(PVOID pvoid);
/*------------------------------------------------------------------------*/
void Thread1(PVOID pvoid)
{
ptMyParams pt=(ptMyParams)pvoid;
DialogBoxParam(pt->hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, MyDlgProc, (LPARAM)pt);
_endthread();
}
/*------------------------------------------------------------------------*/
BOOL CALLBACK MyDlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
ptMyParams pt;
switch(Message)
{
case WM_INITDIALOG:
pt = (ptMyParams)lParam;
pt->hDlg = hWnd;
pt->hProgress = GetDlgItem(hWnd, IDC_PROGRESS1);
return TRUE;
}
return FALSE;
}
/*------------------------------------------------------------------------*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdshow)
{
static MyParams myParam;
int i;
myParam.hInst=hInstance;
_beginthread(Thread1, 0, &myParam);
Sleep(1000);
SendMessage(myParam.hProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 30));
for(i=0;i<30;i++)
{
SendMessage(myParam.hProgress, PBM_SETPOS, i, 0);
Sleep(20);
}
Sleep(1000);
EndDialog(myParam.hDlg, 0);
return 0;
}
////////////////////////////////////////////////////////////////////////////
-- modified at 1:17 Tuesday 15th May, 2007
|
|
|
|
|
Do you get any error on another computers when run your program?
|
|
|
|
|
NO, when i click the exe, i can not see any thing, but the process table shows the procedure until end.
you can run on you computer , the resource just only a dialog with a progress bar.
help, Please!!!
|
|
|
|
|
You said it works on your computer perfect,but when you run it on another computer it doesnt show progress bar,did you try to run exe file or compile source code on another computer?
|
|
|
|
|
|
no , i compile the project on other computer , and run the exe, it is same, i can not see anything.
so, i try to use signal , it is same.
|
|
|
|
|
Besides the problems of using Sleep() for synchronization and improper use of EndDialog(), you
loop for less than a second. Is the dialog gone before it has a chance to paint itself?
Does the loop complete before the dialog is even finished being created?
Using Sleep() for thread synchronization will be problematic at best.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
if i use signal , the condition is same.
|
|
|
|
|
i change the Sleep(20) to Sleep(2000); result is same,
and i debug the project, i received the WM_INITDIALOG msg , so this means the dialog is created, just i can`t see it!!!
what happen in your computer to run this precedure?
i have try 3 machines, just the one which build the project can see the dialog!!!
|
|
|
|
|
I compile your code but I think it doesnt receive WM_INITDIALOG and it seems that hProgress=0x00
|
|
|
|
|
zhongwenjia wrote: what happen in your computer to run this precedure?
It worked fine (XP Pro, SP2).
I did have to add
INITCOMMONCONTROLSEX initcontrols;
initcontrols.dwSize = sizeof(INITCOMMONCONTROLSEX);
initcontrols.dwICC = ICC_PROGRESS_CLASS;
::InitCommonControlsEx(&initcontrols);
to get my dialog to create.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|