|
I have couple of questions, both related.. I would really really love to have even one answered .. Please help ...
Question 1) I place a CEdit control on a View (CView Derived) , using
CEdit's Create() function.. I want to allow the user to click on the Control in the View and to be able to drag and drop it at any new location in the View.. How do i implement this ??
Question2) I Created a AppWizard based MFC container application...
I was able to place a RichTextBox Control in the view using COleClientItem::CreateNewItem(CLSID_RICHTEXTBOX) ... Then using the CRectTracker and its support for COleClientItem i was able to drag, drop and place my active X contol any where in the view as desired.. I want to know how i can invoke the Methods of that ActiveX control (I only have a pointer to COleClientItem's derived class variable which app-wizard created for me)....
Also can i relate a CEdit control variable to a COleClientItem??
Thanks in Advance
ananth
|
|
|
|
|
to make drag and drop work you will have to implement OnDrop BeginDrag and DoDragDrop(Ibelieve this is the name). If you go to your view class and open up ClassWizard you will see a bunch of message handlers and if you scroll down you will see the ones for dragging and dropping. Also you might have to implement OnLButtonClick to instantiate your drag and drop. Hope this helps.
vg
|
|
|
|
|
Hi,
I am trying to build an application to use GDi+. I installed the latest SDk, specifed the latest include and library path. And linked to gdiplus.lib
The problem is when i goto recompile my app, i get a list of errors from the GDIPLUS.H. Along the line of ULONG_PTR undeclared.
Can anyone offer any advice.
Cheers
Richard
|
|
|
|
|
It sounds like you didn't install the Platform SDK right if you're getting that error message. (Check your VC directories again, make sure the Plat SDK directories are before the Msdev ones.) Those _PTR types are in basetsd.h
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
Okay i have a DWORD array declared in the private section of a class header. I then use this array in a function in the class and put some numbers into it. No problem there. But when i try and access the DWORD array in another function in the class the array is empty. This i don't understand why its emptying. I am doing the exact same thing a buffer array i.e TCHAR buffer[size][size] and that one works fine.
Any ideas
Cheers
Peter
p.s. when i tried to do the same thing with a structure containing a buffer and dword that was empty as well like the DWORD array.
|
|
|
|
|
Did you make a malloc of your array?
Best Regards....
Carlos Antollini.
|
|
|
|
|
Please post the code.
Maybe You are making a new instance of class in each function? TCHAR array should be static in such case.
|
|
|
|
|
Right the malloc stuff didn't work. This is really stupid cos all that needs to happen is that one of the class functions writes to a DWORD array and one reads from the dword array.
This is basically whats happening at the moment
this bit declares variables needed in class header and private
<br />
private:<br />
<br />
TCHAR sSigners[STRING_LENGTH][MAX_SIGNERS];<br />
TCHAR sCountSigners[STRING_LENGTH][MAX_SIGNERS];<br />
DWORD dwCountSigners[MAX_SIGNERS]; <br />
<br />
<br />
<br />
UINT uiNumberOfSigners; <br />
UINT uiNumberOfCountSigners;<br />
};<br />
this bit writes data to the TCHAR string and DWORD array
<br />
void CViewSigners::AddCounterSignerToDisplay(TCHAR *psCountSignerName, DWORD dwIndexOfSigCountSigned)<br />
{<br />
if(uiNumberOfCountSigners == MAX_SIGNERS)<br />
{<br />
<br />
TCHAR *psErrorMessage;<br />
TCHAR *psErrorTitle;<br />
<br />
psErrorMessage = new TCHAR[STRING_LENGTH]; <br />
psErrorTitle = new TCHAR[STRING_LENGTH];<br />
<br />
LoadString(_Module.GetModuleInstance(), IDS_MAX_CERTS, psErrorMessage, STRING_LENGTH);<br />
LoadString(_Module.GetModuleInstance(), IDS_CERTERROR_TITLE, psErrorTitle, STRING_LENGTH);<br />
<br />
MessageBox(psErrorMessage, psErrorTitle, MB_OK | MB_ICONWARNING);<br />
<br />
delete[] psErrorMessage;<br />
delete[] psErrorTitle;<br />
}<br />
else<br />
{<br />
char sTest[10];<br />
_ultoa(dwIndexOfSigCountSigned ,sTest, 10);<br />
AfxMessageBox(sTest);<br />
<br />
strcpy(&sCountSigners[uiNumberOfCountSigners][0], psCountSignerName);<br />
dwCountSigners[uiNumberOfCountSigners] = dwIndexOfSigCountSigned; <br />
<br />
uiNumberOfCountSigners++;<br />
}<br />
<br />
}<br />
this bit reads data from the TCHAR string and DWORD array the bottom for loops the one to look at the top for loop is for a different function that similar but that works fine
<br />
BOOL CViewSigners::OnInitDialog() <br />
{<br />
CDialog::OnInitDialog();<br />
<br />
<br />
HTREEITEM hItem[MAX_SIGNERS];<br />
m_imageList.Create(IDB_SIGNER_TREE, 14, 1, RGB(255,0,0));<br />
m_tSignersView.SetImageList(&m_imageList, TVSIL_NORMAL);<br />
<br />
CViewSigners::SetWindowText("Signers");<br />
<br />
<br />
TCHAR sTempCertName[STRING_LENGTH];<br />
<br />
<br />
for(int i = 0; i < uiNumberOfSigners; i++)<br />
{<br />
hItem[i] = m_tSignersView.InsertItem(&sSigners[i][0], 0, 0);<br />
}<br />
<br />
<br />
for(int u = 0; u < uiNumberOfCountSigners; u++)<br />
{<br />
<br />
m_tSignersView.InsertItem(&sCountSigners[u][0], 1, 1, hItem[dwCountSigners[i]]);<br />
<br />
char sTest[10];<br />
_ultoa(dwCountSigners[i] ,sTest, 10);<br />
AfxMessageBox(sTest);<br />
<br />
m_tSignersView.Expand(hItem[u], TVE_EXPAND );<br />
<br />
}<br />
<br />
return TRUE;
<br />
}<br />
peter
|
|
|
|
|
The second 'for' loop uses 'u' variable. But inside You are using 'i':
[code]
for(int u = 0; u < uiNumberOfCountSigners; u++)
{
m_tSignersView.InsertItem(&sCountSigners[u][0], 1, 1, hItem[dwCountSigners[i]]);
char sTest[10];
_ultoa(dwCountSigners[i] ,sTest, 10);//<---- Here, You are using i
m_tSignersView.Expand(hItem[u], TVE_EXPAND );
[/code]
maybe this is the cause of the problem?
Rest looks rather ok.
Make sure, that You initialize all variables with zero in constructor.
Furthermore, You should put into the memory watch the content of the string which is being overwriten. Go through the code and look when it changes.
|
|
|
|
|
Cheers Mate
The i rather then u bit was the problem. I can't belive i missed something that simple i guess it just needs another pair of eyes sometimes.
Thanks Again
Peter
|
|
|
|
|
I have a CView object that is part of a MDI app. This view is created whenever the user wants to capture a frame from a live video source (using DirectShow and WDM). I need functionality that allows the user to right click in this view and have a popup menu come up.
If I don't resize the view, the entire client rect is used by the live video. When I maximize the view, I get a black border around the live video. This black border is expected since the video window must be a certain proportional size.
Problem: If I click in the black border area, I get my popup menu. If I click on the video "window", the mouse clicks get eaten. I need the mouse clicks to be handled when they are performed over the video (as well as when they are performed over the black border section).
If you need to ask questions, I will answer them to the best of my ability.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Inside you'r CView you're using a kindof a control? a CWnd derived class. This CWnd derived class Trap the mouse capture so, the event is catch by this and not by you'r cView. So you must do somthing Inside this CWnd control to handle this event and from there call you'r function
anything DisplayPopupMenu(void)
{
}
this will be call from you'r CView class AND from you'r control who diplay the animation.
hope this will help
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
I'd suggest using SetCapture when the mouse is over the video feed, so that the mouse message is caught by your main window. I'm presuming the video is coming in through a control you cannot edit to catch the message directly.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
DirectShow is a pain in the ass. Here's what I'm doing:
When the view is instantiated (due to the user clicking a menu item to view a video window), the view sends its hwnd to another class which controls access to a DLL. The DLL calls SetWindowLong(theCviewHwnd, GWL_WNDPROC, callbackFunc) so that the mouse clicks can be passed back to the original window. The results are as I stated before - if I right-click in the black border area (not covered by the live video stream window), the view responds as expected with a popup menu being displayed, but if I click on the rectangle containing the video, the mouse click is ignored.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I just found out what I was doing wrong (or more accurately, not doing at all). It's got to do with an interface in the COM object. I wasn't calling a function that directs messages to the owner window (because the documentation implied that it only forwarded video events to the parent window, and not regular windows commands).
Sometimes, MSDN help sucks.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
please help me to solve this problem:
when graphic primitives (rectangles) are printed being filled with standart brush (CreateSolidBrush(...)) it's OK
BUT when filled with custom (CreatePatternBrush(...)) nothing is printed.
SOMEBODY PLEASE HELP MEEEEEE.
|
|
|
|
|
You mean printed to paper ? This is a common question - when you print with a pattern brush it cannot be stretched, it repeats itself. This makes pattern brushes unacceptable for printing, because a print DC is so much bigger than a screen DC. Use a bitmap and stretchblt instead.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Is there a way to align text in a status bar pane? I need to right align one of the panes in my status bar.
Also, I need to know how to include a tool-tips type display when the pane is scrolled over. Any help is appreciated.
Thanks,
Andrew
|
|
|
|
|
What's a good book for learning STL on its own? I have programmed C++ for about two years, mostly in Win32 and MFC and just old fahsioned C++ without STL. But I wanted to learn a bit more about STL. I have used the odd occasional STL stuff, like the string or vector, but I can't say that I really know a whole a lot about STL.
thanks
|
|
|
|
|
The book I learned from is from Addison Wesley and it's called STL Tutorial and Reference, 2nd ed. Between that and the STL section of Stroustrup, you're away. The SGI online docs are also useful.
Beyond that, there is a new book called 'Effective STL' which I believe is not for the STL beginner, I am eagerly awaiting my copy so I can't say more except that from all accounts you should buy it after working through the first book mentioned.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
I am building a program that all the command "C:\myapp.exe %1" to be ran when a user right click any file and choses "Run myapp.exe" and also does the same for folders. This all work great but one problem with my keys removed to the REG the all CPP files will open in to VC++ when DBClicked. With my key in the REG all the CPP files will open myapp.exe because the shell decided to place "Run myapp.exe" add the top of the menu and make it default. Since I want all the files to "Run myapp.exe" I do want them to have them be default or users will get mad. Now I know there is Tutorials on the shell and file assocation on MSDN where it talks about when ShellExecute() is ran the shell lookes for the...
1) Open Key
2) Default Key
3) The first key in REG (I think this is where I am.
4) (I cant rememeber what was here.)
1) and 2) might be switch around.
...order of verbs to file the verb to use to execute.
Well that all I can say for now...
Any help...
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
It's about the "change one thing in an other dialog" stuff!
Let us say I create a new app with AppWizard.
I put a button on that dialog (Dialog 1).
When I push that button a second dialog (Dialog 2) appears that has WS_POPUP style.
Then I put a button on that dialog too.
When I push that button I want to for eg. change the caption on the button that is on Dialog 1, HOW??
I tried this:
CDialogOneDlg dlg;
dlg.btn.SetWindowText("TEST"); // dlg = 'Dialog 1', btn = a CButton on Dialog 1
But the compiler says there is no window??hmmm...
The dialog is already created so why this error message??
------------------------------
CodeCracker - That's me!
------------------------------
|
|
|
|
|
But the compiler says there is no window??hmmm...
The dialog is already created so why this error message??
It's true that the C++ object of the dialog is created but not the window. The window will be created when you call something like dlg.DoModal();
As for the 2 dialog issue, you can save the pointers of the first dialog in the 2nd one and thus once the 2nd on is displayed, you have the access to all of the controls in the first one.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
CDialogOneDlg dlg;
dlg.btn.SetWindowText("TEST");
there you create a new CDialogOneDlg. You must get a pointer to you'r previous CDialogOneDlg, (CDialogOneDlg* dlg) and for this you will have to do something like
CDialogOneDlg* p_dlg;
p_dlg = (CDialogOneDlg*)this->GetParent();
p_dlg->btn.SetWindowText("TEST");
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
THANK YOU SO F***ING MEGA BIG MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
YOU SHOULD BE THE NEXT KING!!!!!!!!!!
DAMN THANK YOU!!!!!!
------------------------------
CodeCracker - That's me!
------------------------------
|
|
|
|