|
BSTR->string
LPCTSTR->const string
LPSTR -> string
unsigned int->UInt32
DWORD -> long
|
|
|
|
|
Hi
Cool guys of this messageboards suggested me to use RegNotifyChangeKeyValue() function in order to be informed/notified of registry modifications (what i'm looking at).
It works but it only notifies me that something changed but i can't find how to figure exactly WHAT changed ?
thanks
|
|
|
|
|
RegNotifyChangeKeyValue() will notify you of any changes that is made to the key that *you* pass the API as the first parameter, hKey .
Alexandre GRANVAUD wrote: It works but it only notifies me that something changed but i can't find how to figure exactly WHAT changed ?
Use RegQueryValueEx() to get the modified value of the registry key. You could compare it to the old value, and you'd know what's changed.
Shog on learning VB6: Ah, that would have been VB6. Kicked my ass anyway. So easy to learn, just like falling down a flight of stairs...
|
|
|
|
|
yes but i need to know which subkeys are created in a large tree
|
|
|
|
|
Hi all,
I have a little problem with printing. The case is that my program has multiple views and I need to print different things depending of the view that is active in this moment. I have derived a Dialog from CPrintDialog to allow some parameters selection and to print different outputs according to these parameters. I have successfully called the new DialogBox and set the parameters to choose the output. My problem is that, as I have overridden the CNewPrintDialog::OnOk () to modify the things I need, when I click OK in my dialog and send the work to print… I have an error because the DeviceContext for the printer is not correctly saved in pInfo->m_pPD->m_pd.m_hDC. My question is… where can I find the implementation (not the definition) of the CPrintDialog to see its CPrintDialog::OnOk and copy what I need in my Dialog???
Or… How should I make it to successfully send the datas to be printed? I have tried to print with what Chris Maunder’s says in one of his articles (Printing without the Document/View framework) but it doesn’t solves my problem because I do use the framework
Any help will be wellcome
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?
|
|
|
|
|
Nelek wrote: an error because the DeviceContext for the printer is not correctly saved in pInfo->m_pPD->m_pd.m_hDC
Can you show how do you set m_hDC and see Print Bitmaps without Doc/View Framework[^] is helpfuls?
|
|
|
|
|
Hi,
I have made:
BOOL CMyView::OnPreparePrinting(CPrintInfo* pInfo)
{
CMyDoc* pDoc = GetDocument ();
ASSERT_VALID (pDoc);
delete pInfo->m_pPD ;
pInfo->m_pPD = new CDlgPrinting(FALSE, PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION, this) ;
pInfo->m_pPD->m_pd.hInstance = AfxGetInstanceHandle();
pInfo->m_pPD->m_pd.lpPrintTemplateName = MAKEINTRESOURCE(IDD_PRINT_PRDLG);
pInfo->m_pPD->m_pd.Flags |= PD_ENABLEPRINTTEMPLATE;
pInfo->m_pPD->m_pd.nMinPage = 1;
pInfo->SetMaxPage (CalculateNumberOfPages ());
int nAnswer = pInfo->m_pPD->DoModal ();
if (nAnswer == IDCANCEL)
return FALSE;
CDC dc;
dc.Attach (pInfo->m_pPD->GetPrinterDC ());
pInfo->m_pPD->m_pd.m_hDC = dc.GetSafeHdc ();
if (m_byPrintParam)
AfxMessageBox ("Parameters modified");
else
MessageBox (NULL, "Error by taking parameters", "Error", MB_OK);
dc.Detach ();
return TRUE;
}
But I get an Assertion and he brings me to code
ASSERT (pInfo->m_pPD->m_pd.m_hDC != NULL);
EDIT
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?
|
|
|
|
|
Did you check step by step whats return value of dc.Attach ?
|
|
|
|
|
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!!!
|
|
|
|