|
Overide your document's OnOpenDocument() and OnSaveDocument() members.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Hi,
How can i unregister an ActiveX in my computer ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
Use regsvr32 with the /u option.
Regards,
Alwin
|
|
|
|
|
Use regsvr32. Call it without parameters to get the usage information.
HTH,
Thomas
I am a signature virus!
Help me spread and copy me to your sig!
|
|
|
|
|
There's also some registry hacks that add register and unregister to the right click menu. They're either on this site or codeguru. If the file is located in "%windows%\downloaded program files" then you can right click on it and select remove.
|
|
|
|
|
Here is how I do it on my machine (for adding right click menu option)
Open your registry using RegEdit (not regedit32)
Find The key HKEY_CLASSES_ROOT\dllfile\Shell
Create a new Key call it RegisterIt
HKEY_CLASSES_ROOT\dllfile\shell\RegisterIt\
in the default string change it to "Lets register this"
Create a subkey call it Command
HKEY_CLASSES_ROOT\dllfile\shell\Register\command
in the default string type the "regsvr32 "%1""
And there you go.
cheers
Alfadhly
It is Illogical to define an inventor by his invention
|
|
|
|
|
I have my Own Method, and I want to share it with all you
First I call AfxOleInit()
Then load the ocx with the function LoadLibrary()
Whit the handle that returns LoadLibrary I call the GetProcAddress() function.
For example:
if(AfxOleInit())
{
HINSTANCE hInst = LoadLiabrary("my.ocx");
if(hInst != NULL)
{
typdef HRESULT (CALLBACK *HCRET) (void);
lpDllReg = (HCRET)GetProcAddress(hInst, "DllRegisterserver"); //or "DllUnRegisterserver"
if(FAILED((*lpDllReg)()))
{
AfxMessageBox("DLLRegisterServer() Failed");
}
}
}
Enjoy!!!!!
Carlos Antollini.
|
|
|
|
|
I have been wondering this many times about various things, in this case I have used ADO:
Why is it that when i use "_ConnectionPtr myPtr" I then can access different member functions depending on if I use dot notation or -> notation......
myPtr-> // Brings up one lot of things in intellisense menu
myPtr. // Brings up different ones
I was wondering why this is the case, as I wouldnt have thought that the second one would do anything after all myPtr is a pointer....
Thanks
|
|
|
|
|
> after all myPtr is a pointer
It's a 'smart pointer'. The smart pointer is an object of the class that overrides the operator-> - in your case it'a _com_ptr_t template.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
myPtr. accesses methods/members of the 'smart_ptr' class used to create the pointer (e.g. CreateInstance)
myPtr-> accesses methods/members of the class type of the pointer
This isn't a great explanation and may not be 100% accurate, but it's how I keep them straight.
>>>-----> MikeO
|
|
|
|
|
Hello,
I have to use 4 charts that plot data incrementally about every 1.5 seconds.I am using MS Chart control
The problem :
The MS Chart Control refreshes everytime i send COleSafeArray to the chart control. This produces an unwanted/undesirable flash while updating. How can i plot to the MS Chart OCX incrementally without having to refresh the entire control everytime a new point is plotted.
Also, i shall be grateful if somebody can guide me with a small piece of code example for doing the same.
This is what i am currently doing(code fragment)
void CChartDlg::UpdateGraph(COleSafeArray saRet1)
{
// Return the safe-array encapsulated in a VARIANT...
m_Chart.SetChartData(saRet1.Detach());
// m_Chart.Refresh();
}
void CChartDlg::OnTimer(UINT nIDEvent)
{
num++;
if (num>=100 || num <0)
num=0;
index[0]=num;
for(index[1]=0; index[1]<2; index[1]++)
{
val = rand()/1000;
// Change to COleVariant
saRet.PutElement(index, COleVariant( val));
}
UpdateGraph(saRet); //Call UpdateGraph function
CDialog::OnTimer(nIDEvent);
}
Thanks in advance
Dashmesh
-------------------------------------------
Dashmesh A. Singh
Tata Consultancy Services,
INDIA
e-mail: visions_next@yahoo.co.uk
dashmesha_singh@tcscal.co.in
|
|
|
|
|
I am trying to get ADO working in VC.... however, when I try and connect to the database my program crashes at this line:
m_pConn->Open ( _bstr_t ( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = mydb.mdb" ),
_bstr_t ( "" ), _bstr_t ( "" ), adModeUnknown );
Can I also ask what does the _bstr_t thing do. I presume its a type. If so what is this type, and why do i keep seeing type names when passing arguments??!
|
|
|
|
|
Did you initialize your connection pointer?
m_pConn.CreateInstance(__uuidof(Connection));
>>>-----> MikeO
|
|
|
|
|
Thanks Mike, but I did do that, here is my code:
_ConnectionPtr m_pConn;
m_pConn.CreateInstance (__uuidof(Connection));
m_pConn->Open ( _bstr_t ( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = ADOTestDB.MDB" ),
_bstr_t ( "" ), _bstr_t ( "" ), adModeUnknown );
It just crashes, saying "abnormal program termination"...
also, what does the __uuidof and _bstr_t do? It seems weird including types in an argument list....
Thanks
|
|
|
|
|
::CoInitialize(NULL);
_ConnectionPtr m_pConnection = NULL;
CString m_strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = ADOTestDB.MDB");
m_pConnection.CreateInstance(__uuidof(Connection));
try
{
HRESULT hr;
hr = m_pConnection->Open(_bstr_t(m_strConnection), "", "", NULL);
if(hr == S_OK)
TRACE("Connected");
}
catch(_com_error &e)
{
TRACE("Connect Failed.");
}
Good Luck....
Carlos Antollini.
|
|
|
|
|
I've got this problem with sorting items in my treectrl...
To sort the Children of a Parent i'm using the function SortChildrenCB. According to the Example in MSDN (CTreeCtrl::SortChildrenCB) 'the lParam of an item is just its handle'. This is incorrect in my situation, because the values of lParam1 and lParam2 represent my itemdata! Even with the exact code from the example from MSDN i receive the itemdata value als lParam...
Any tips/hints?
|
|
|
|
|
It's apparently an error in MFC documentation, lParam1 and lParam2 are item data. CTreeCtrl::SortChildrenCB is just a MFC wrapper over TVM_SORTCHILDRENCB message. The funny thing is that they have it documented correctly in "Windows Common Controls/Tree view":
"int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lParamSort);
[...]
The lParam1 and lParam2 parameters correspond to the lParam member of the TVITEM structure for the two items being compared."
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
So, now I know how to create an automation which open known Excel workbook and worksheet. But the aim of my job is, after this first step, to read and catch cells.value to be used in functions which are implemente with vc++. My question is how could I do that?
Thank you for your help
Gerald
|
|
|
|
|
Just a quick question? Why is the value of the member variable linked to an edit box always empty until I call CDialog:OnOK(). I'm guessing it has something to do with DoDataExchange but I haven't quite worked out what. What is the proper way to do this because I was always under the impression that you should call the base class last...
|
|
|
|
|
Whenever u want the data on the dialog box to come into its vairables call UpdateData(TRUE) and whenever u want the data in ur variable to go into the dialogbox call UpdataData(FALSE)
I hope this is what u r looking for
|
|
|
|
|
Just a quick answer: call UpdateData() and your member variable will be up to date.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
There is no rule about calling base class functionality. If you need it to do its work before your work, you call it first. If you need it to do it after, you call it after. If you don't care either way, then do it one or the other, but always be consistent.
OnOK() calls UpdateData() during its processing, which you can do at any time you need to (though some say that having to call UpdateData() is a sign of a poorly designed program. I don't always agree, Dialog based apps often need to call it).
|
|
|
|
|
Is it possible to add my own custom control to a CommandBar?
I have made my own bar with a couple of buttons, but now I would
like to add a control of my own also.
Can it be done?
/Jerry
|
|
|
|
|
Hi all:
Do you know what is the POSITION type in VC++? How can we use it?
|
|
|
|
|
From MSDN:
POSITION
Placeholder for a linked list.
struct __POSITION { int unused; };
typedef __POSITION* POSITION;
Members
unused
Integer value that specifies the location of an item in a linked list.
Remarks
This structure can point to any element in a linked list, including null elements (such as an end-of-list marker). This structure will, however, become invalid if you delete the item it points to.
When you perform operations that return a POSITION pointer on a single list element, a successful operation sets it to an appropriate non-null value, while NULL indicates that the items position could not be found. When you perform operations on the entire list, the pointer represents a Win32 BOOLEAN value, where TRUE indicates success and FALSE indicates failure.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|