|
Hello all,
I have drawn some stuff on my view [Those who have been following my GDI threads would know I am trying to decode a funny image format]
Well now I have sorta decoded it and I wanna save it as a bitmap.
Any help is hugely appreciated!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
if i want to look at the actual code behind something like CEdit, how do i look at the actual code of that class? the way i have been doing it is deriving a class from it and then looking at the base class functions.. i know there has to be another way right?
p.s. im using .net
thanks!
-dz
|
|
|
|
|
%Program Files%\Microsoft Visual Studio.NET\Vc7\atlmfc\src\mfc
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
hrm.. no easy browser tho eh? i see the filenames aren't exactly descriptive.. i tried doing a text search in the folder for CEdit, but of the 4 files it returned none really seemed like the right thing.. im just using CEdit as an example tho.. thanks for the info!
-dz
|
|
|
|
|
The files are AfxWin.h, AfxCmn.inl, AfxWin2.inl, WinCtrl1.cpp. They containt the declaration of the class and the implementation. What exactly are you looking for.
Best regards,
Alexandru Savescu
|
|
|
|
|
CEdit inherits from CWnd, you might need to look at the CWnd source code too.
Michael
Errata 1: p. 154, section 'Defusing'. For 'red wire' read 'blue wire'.
|
|
|
|
|
You have the following browsing options in vs.net:
1) Object Browser - in View|Other Windows. This window also opens when you select 'Browse definition' from context menu invoked on class name in ClassView
2) You can open mfc.bsc file using File|Open, this will show the complete hierarchy in Object Browser window. mfc.bsc is in vc7\atlmfc\src\mfc
3) ClassView displays 'Base classes and Interfaces' for each class in your project. Just expand it and you'll see base class --and-- its base classes as well, so you'll be able to drill down from CYourEdit through CEdit, CWnd, CCmdTarget to CObject
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
CoInitialize(NULL);
ISimplePgpPtr p(__uuidof(SimplePgp));
p->EncryptFile("d:\\in.txt","d:\\a90.pgp","test@test.com");
p.Release();
CoUninitialize();
Notice how I am calling Release()
My question is this. If it's a smart pointer shouldn't it automatically call Release() in its destructor?
Nish
p.s. I tried leaving out the call to Release() and it crashed
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
because you called CoUninitialize which happens before the smart pointer falls off the stack and has it's destructor called
try this:
CoInitialize(NULL);
{
ISimplePgpPtr p(__uuidof(SimplePgp));
p->EncryptFile("d:\\in.txt","d:\\a90.pgp","test@test.com");
p.Release();
}
CoUninitialize();
|
|
|
|
|
Jim Crafton wrote:
CoInitialize(NULL);
{
ISimplePgpPtr p(__uuidof(SimplePgp));
p->EncryptFile("d:\\in.txt","d:\\a90.pgp","test@test.com");
p.Release();
}
CoUninitialize();
Thanks. That worked even when I commented out the call to Release()
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Making it a statement block (enclosed in braces { }) forces the code to execute as a block and clean up after itself.
|
|
|
|
|
First of all, Thanks to Rama, Mazy and Jason.
Here is my code now. It works by the way
ISimplePgpPtr p(__uuidof(SimplePgp));
p->EncryptFile("d:\\in.txt","d:\\a90.pgp","test@test.com");
p.Release();
CoUninitialize();
Now this is my problem. I am puzzled by the behavior of p.
When I hit a . after p and when I type a -> after p I get different drop downs from intellisense.
Can someone clear all this up?
I tried a . instead of -> for the EncryptFile but got a compile error!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
The . shows the member of _com_ptr_t class. this class has the -> operator overloaded, which shows you the member of ISimplePgp class.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Michel Prévost wrote:
The . shows the member of _com_ptr_t class. this class has the -> operator overloaded, which shows you the member of ISimplePgp class.
Thanks Michel. Makes sense now
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Michel is right it's just overloaded.
Extra info.
I finished a Design Patterns class last semester and the overloaded operator -> was given as an example. It's a Proxy design pattern. If you're interested here's a link.
Houston Design Patterns [same page]
It's in the Structural Patterns. Check out the C++ demo for Proxy design pattern. When you get to the source I believe it's the 3rd example.
nay
|
|
|
|
|
Hello, CPians, I have an MFC SDI application, and I want to access to CMyView from CMyApp::InitInstance(), how can I get it?
Thanks a lot in advance!
|
|
|
|
|
lucy wrote:
I want to access to CMyView from CMyApp::InitInstance(),
Have you created your main frame window? If so you can call GetActiveView on the main frame pointer.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
yes, it should be created in the standard initialization code in CMyApp::InitInstance(). But what is the pointer to the main frame window? I tried to use m_pMainWnd, but it has no member function of GetActiveView.
|
|
|
|
|
((CFrameWnd*)m_pMainWnd)->GetActiveView()
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish, you are so great! Thank you so much!
Okay, now I can go to bed to have my beauty sleep.
|
|
|
|
|
I have an icon in the system tray. When I right click the icon I do this:
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,
point.x, point.y, AfxGetMainWnd(),NULL);
where pPopup is a pointer to my menu. When I right click it, if you dont want to do anything you would click outside of the popup menu and it dissappears, however it doesnt dissappeat unless you click the mouse outside of the menu then hover the mouse over the menu. How do I fix that?
-Raffi
|
|
|
|
|
Try using TPM_RIGHTTBUTTON , or not using TPM_LEFTBUTTON .
--------
Life is fraught with opportunities to keep your mouth shut. --Shog9 --
|
|
|
|
|
I have, it has no affect.
-Raffi
Why do today what can be put of until tommorrow?
|
|
|
|
|
Raffi wrote:
I have, it has no affect.
Odd...
I just checked MSDN, it gives this little tidbit:
To display a context menu for a notification icon, the current window must be the foreground window before the application calls TrackPopupMenu or TrackPopupMenuEx. Otherwise, the menu will not disappear when the user clicks outside of the menu or the window that created the menu (if it is visible). However, when the current window is the foreground window, the second time this menu is displayed, it displays and then immediately disappears. To correct this, you must force a task switch to the application that called TrackPopupMenu at some time in the near future. This is done by posting a benign message to the window or thread, as shown in the following code sample:
SetForegroundWindow(hDlg);
TrackPopupMenu( hSubMenu,
TPM_RIGHTBUTTON,
pt.x,
pt.y,
0,
hDlg,
NULL);
PostMessage(hDlg, WM_NULL, 0, 0);
Have you tried that?
--------
Life is fraught with opportunities to keep your mouth shut. --Shog9 --
|
|
|
|
|
Thats exactly the problem. Thanks for the fix.
-Raffi
Why do today what can be put of until tommorrow?
|
|
|
|