|
I think you are better off if you use a std::vector of std::vector . I have used them successfully.
Best regards,
Alexandru Savescu
|
|
|
|
|
thanks a lot you guys, i'll try the std:vector asap, for now i have solved my problem by using a struct cl instead of class cl where i have direct access to my pointer and where i can get mem whereever i want.
i know i have made an error above, its a CArray <t,t> a.s.o.
thank you !
|
|
|
|
|
I have an article on using vector here on CP, it's far superior to CArray which was written to fill the gap until vector arrived.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Hi
I want to change the text of the of the status bar and the text of tool tips upon the context.
I can add a pane in witch I can write but I don't know how to write in the message pane.
Is anybody knows how to do that?
Thanks in advance
mic
|
|
|
|
|
There are two ways to do what you want:
1. Get the status bar object and call SetPaneText() on it.
2. For the pane ID e.g. ID_MY_PANE, write a CCmdUI handler for it and update the text in that handler
Not sure about the tooltips.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
thank you very much
I try it
mic
|
|
|
|
|
when drag & drop buttons from CToolBarCtrl, default drag icon is a small hand, i need my own icon for special required.
do u know how to change the small hand to my icon?
thx
includeh10
|
|
|
|
|
Hi,
In a dialog based application, I have a bitmap image displayed in a button.
Now i want to select a part of the image (such as, draw a rectangle in the
image), and then i want to enlarge the selected part of the image or save the selected part as another bmp file. Note that: i used 8-bit bmp image.
How should i do?
Thanks in advance!
chen
|
|
|
|
|
You need to use stretchblt to resize it, and read the FAQ to see how to save it.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Yes, you are right. I can enlarge the image with the stretchblt
function. Thanks a lot. But, i also want to resize the size of the
image to fit the size of the dialog. Because the dialog is resizable. Is there a method to adjust the size of the image to fit
the dialog window when it has been changed already with mouse drag?
Thanks in advance!
chen
|
|
|
|
|
I suspect what you are asking is how to know the size of the dialog to draw the image. The answer is to draw in WM_ERASEBACKGRND, and use GetClientRect to find out the size to draw.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Hi all!
I cannot create a thread. Help me do this please.
I want to do it with CreateThread function on Win 2000.
Could you give a simple example!
Thanks for your help!
Denis_aka_NULL
|
|
|
|
|
but there are a lot of samples ... here, just SEARCH (: !!!
----------------------------
my eng is bad, so am i .. (:
|
|
|
|
|
OK, thank you!
I've found it...
|
|
|
|
|
I have made an ActiveX control and I was working with it in a MFC application that uses the CMultiPageDHtmlDialog class.
The problem is that when I close the aplication an assert ocurs. The message is : dwCookie != 0 && dCookie <= (DWORD)m_nSize.
The assert is placed in a method called GetUnknow. It's ocurs when the application is disconnectin the events (I think). Any suggestion ?. Thanks.
|
|
|
|
|
in any cases, before app (a process) destroys, all threads created by the app should be destroied. if not, often (not always) exception happends.
wait a while, check thread's status, i think it will help.
includeh10
|
|
|
|
|
I have a VB dll(ActiveX dll). The project only has dll file and library file.
I used it like this:
typedef VOID (*VTPROC)(LPTSTR);
void MyProc()
{
HINSTANCE hinstLib;
VTPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
// Get a handle to the DLL module.
hinstLib = LoadLibrary("VTProj");
// If the handle is valid, try to get the function address.
if (hinstLib != NULL)
{
ProcAdd = (VTPROC)GetProcAddress(hinstLib, "Initialize");
// If the function address is valid, call the function.
if (fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd) ("message via DLL function\n");
// Free the DLL module.
fFreeResult = FreeLibrary(hinstLib);
}
// If unable to call the DLL function, use an alternative.
if (! fRunTimeLinkSuccess)
printf("message via alternative method\n");
}
The ProcAdd was always NULL.
Could anyone help me solve the problem?
Thanks.
No pains, no gains.
|
|
|
|
|
hi i coppied this from msdn please go through....
Method 1 - CreateDispatch:
1.Start Visual C++ and select New on the File menu. Choose MFC AppWizard (Exe) and a project name, and Click OK. When the MFC AppWizard dialog box appears, click Finish. Click OK on the next dialog box.
2.Select ClassWizard on the View menu, pick Ctst1App in the Class Name box, and double-click InitInstance in the Messages box. Click Edit Code to bring up the code for BOOL CTst1App::InitInstance(), find the line AfxEnableControlContainer();, and add the following line before it:
3.
AfxOleInit();
4.Select ClassWizard from the View menu and click the Automation tab. Click AddClass and select "from a TypeLibrary". Specify Project1.dll, the Visual Basic DLL which was created in step 3. When the Confirm Classes dialog box appears, click OK. Click OK again to close the MFC ClassWizard dialog box.
5.Open your <app name="">.cpp file and add the line #include "Project1.h". You need to include Project1.h wherever you have code that accesses project1.dll.
6.Open the ClassWizard again. On the Message Maps tab, select CAboutDlg in the Class Name box and IDOK in the Object IDs box, and then double-click BN_CLICKED. Click OK in response to the dialog box and OK again to close the ClassWizard.
7.Open <app name="">.cpp, scroll to the bottom to theCAboutDlg::OnOK(), and replace it with the following code:
8.
9. void CAboutDlg::OnOK()
10. {
11.
12. short st = 2;
13. short st1;
14. _Class1 p;
15. p.CreateDispatch("Project1.Class1");
16. st1 = p.MyVBFunction(&st);
17. CDialog::OnOK();
}
18.Compile your .exe file (F7).
19.Run the .exe file and select About on the Help menu. Click OK on the About box and the message box that was specified in project1.dll appears. Click the Close button to dismiss the dialog box.
Method 2 - #IMPORT:
1.Start Visual C++ 6.0 and create a Win32 Console Application. Select "An Empty Project" and click Finish.
2.Point to Add to Project on the Project menu and click New to add a new C++ source file to the project. Paste the following code in the new source file and save it:
3.
4. #include <stdio.h>
5.
6. // This is the path for your DLL.
7. // Make sure that you specify the exact path.
8.
9. #import "c:\project1.dll" no_namespace
10.
11. void main()
12. {
13. BSTR bstrDesc;
14.
15. try
16. {
17. CoInitialize(NULL);
18. short st = 2;
19. short st1;
20. // Declare the Interface Pointer for your Visual Basic object. Here,
21. // _Class1Ptr is the Smart pointer wrapper class representing the
22. // default interface of the Visual Basic object.
23.
24. _Class1Ptr ptr;
25. // Create an instance of your Visual Basic object, here
26. // __uuidof(Class1) gets the CLSID of your Visual Basic object.
27.
28. ptr.CreateInstance(__uuidof(Class1));
29. st1 = ptr->MyVBFunction(&st);
30. }
31. catch(_com_error &e)
32. {
33. bstrDesc = e.Description();
34.
35. }
36. CoUninitialize();
}
37.Compile and run your project. The message box from Project1.DLL should appear.
The #import method can be used in a Win32 Application, a Console Application, or in MFC as well.
Method 3 - Pure COM Interface
1.Start Visual C++ and select New from the File menu. Choose MFC AppWizard (Exe), name the project tst1, and click OK. When the MFC Appwizard dialog box appears, select Dialog Based and click Finish. Click OK when the next dialog box appears.
2.The Resource Editor is started by default. Delete all the controls on the dialog box and add a Command button on it, retaining the default caption "Button1".
3.Double-click Button1 to display the Add Member Function dialog box. Click OK to accept the name OnButton1.
4.Click OLE/COM Object Viewer on the Tools menu. Select View Typelib from the File menu and choose the Project1.dll you created earlier. Click Open to display the ITypeLib Viewer, which contains the .idl file for your DLL.
5.Copy the contents of your .idl file (contents of the right pane) to the Clipboard. Hold the SHIFT key down while paging or scrolling from the first character to the end of the text in the pane. Press Ctrl+C to copy the marked text to the Clipboard.
6.Click New on Visual C++ File menu. Select Text File on the New dialog box, name the file test1.idl, and click OK.
7.A blank text file appears. Paste the data from the Clipboard into it and save the file.
8.Select Settings from the Project menu, expand the tst1 and Source Files nodes of the tree view, and select test1.idl. Click the MIDL tab, enter test1.h in the "Output header file name" box, and click OK.
9.Open tst1Dlg.cpp and add the following files to the includes section:
10.
11. #include <initguid.h>
#include "test1.h"
12.Click the ClassWizard on the View menu, select Ctst1App in the Class Name box, and double-click InitInstance in the Messages box. Click Edit Code to bring up the code for:
13.
BOOL CTst1App::InitInstance()
Find the line:
AfxEnableControlContainer();
Add the following line before it:
AfxOleInit();
14.Open the ClassWizard again. On the Message Maps tab select CTst1Dlg in the Class Name box and IDC_BUTTON1 in the Object IDs box. Double-click BN_CLICKED in the Messages box, and click Edit Code to bring up the code for void CTst1Dlg::OnButton1(). Replace the OnButton1() function with the following code:
15.
16. void CTst1Dlg::OnButton1()
17. {
18. // TODO: Add your control notification handler code here.
19.
20. _Class1 *pClass = NULL;
21. IUnknown *pUnk = NULL;
22.
23. // HRESULT hr = CoCreateInstance(CLSID_Class1,NULL,
24. // CLSCTX_INPROC_SERVER,IID__Class1,(void **)&pClass);
25. // You can directly get the Interface ID as in the previous line or
26. // you can do a QueryInterface on IUnknown to get the IID
27. // as in the following three lines:
28.
29. HRESULT hr = CoCreateInstance(CLSID_Class1,NULL,CLSCTX_INPROC_SERVER,
30. IID_IUnknown,(void **)&pUnk);
31. hr = pUnk->QueryInterface(IID__Class1,(void **)&pClass);
32. pUnk->Release();
33.
34. // Once you have the IID, you can make use of the interface pointer
35. // to access our Visual Basic DLL.
36.
37. short st = 2;
38. short st1;
39. hr = pClass->MyVBFunction(&st,&st1);
40. pClass->Release();
41.
}
|
|
|
|
|
Thank you very much.
I am trying...
No pains, no gains.
|
|
|
|
|
how do i allow multiple selection in a tree-view... i don't care if i have to hack it or anything... i tried it already and there were lots of problems with items being focused and stuff.. my method was to catch TVN_SELCHANGING and TVN_SELCHANGED but those always had problems
can anyone enlighten me? i would like to still use SysTreeView32 and CTreeCtrl if possible (a raw API method is fine too)
thanks a lot guys
-Roman
- Roman -
|
|
|
|
|
The simple answer is that you can't. The standard tree view control does not support multiple selection. I think your only solution will be to use some kind of custom control. One possibility involves using a list control instead, and manipulating the item indents, but things get quite complicated.
You could have a look here in CodeProject at the tree control section and see if any support multiple selection, but if they're based on SysTreeView32 they won't. The tree/list hybrids might be more useful.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Undoubtedly,it can.
But you should derive a class from CTreeCtrl,and override each function related to multiple select,e.g.,OnKeyDown,OnClick,and use SetItemState() to
achieve multiple select,it is a complex work,and you should think over many things.If you do well,you will fullfill a multiple select tree like the one in VC's ClassView window.
|
|
|
|
|
You can see this topic
http://www.codeguru.com/treeview/multiple_sel.shtml
But it is not ferfect,for multiple select in tree view is a very complex
work.
Cherrs
|
|
|
|
|
You can see this topic
http://www.codeguru.com/treeview/multiple_sel.shtml
But it is not perfect,for multiple select in tree view is a very complex
work.
Cherrs
|
|
|
|
|
i use +- http://www.techsoft.no/bendik/
t!
|
|
|
|