|
sorry ! and thank's for the advice
I'll try to explain more:
when I insert the control activeX in my CFormView I create for it a member
variable with the wizard of "VC++ .net" as a control in the category.
so it's like this :
CPrincipale::CPrincipale()
: CFormView(CPrincipale::IDD)
, m_DTC()
{
}
then I do what I said before
i put in the class port.h this line:
CMyinterfacectrl1 *pDTC; //pointer to the class which was created when I insert the control.
and I use it like this in port.cpp
pDTC->setWorkIndex(...);
pDTC->ComPortOpen(....);
in my CFormView CPrincipale.cpp
I call my CDialog like this:
void CPrincipale::onPort()
{
Cport p;
p.pDTC=&m_DTC;
p.DoModal();
}
I hope that is clear enough
please help me !
|
|
|
|
|
But, why are you doing that ? Why have a pointer to your activeX control in a class that has nothing to do with it ? (and your explanation is still not very clear...)
|
|
|
|
|
because if I want to add a control ActiveX I must select the FormView
right click > insert Control ActiveX
then select the control add variable > category control
so it generate two files here you are some code of itdcinterfaceCtrl.h
class CItdcinterfacectrl1 : public CWnd
{
protected:
DECLARE_DYNCREATE(CItdcinterfacectrl1)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0xFB05973A, 0x3C1E, 0x46DC, { 0x95, 0x93, 0xDC, 0xEE, 0xC4, 0x29, 0xDC, 0x88 } };
return clsid;
}
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
}
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey);
}
// Attributs
public:
// Opérations
public:
// _DITDCInterface
// Functions
//
void DoorTimeSchedule(LPCTSTR DoorTimeSchedule1, LPCTSTR DoorTimeSchedule2, LPCTSTR DoorTimeSchedule3, LPCTSTR DoorTimeSchedule4)
{
static BYTE parms[] = VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR ;
InvokeHelper(0xb, DISPATCH_METHOD, VT_EMPTY, NULL, parms, DoorTimeSchedule1, DoorTimeSchedule2, DoorTimeSchedule3, DoorTimeSchedule4);
}
void AccessDoor(LPCTSTR DoorIndex1, LPCTSTR DoorIndex2, LPCTSTR DoorIndex3, LPCTSTR DoorIndex4)
{
static BYTE parms[] = VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR ;
InvokeHelper(0xc, DISPATCH_METHOD, VT_EMPTY, NULL, parms, DoorIndex1, DoorIndex2, DoorIndex3, DoorIndex4);
}
but if I create a class to this control and not a member variable I don't obtain attributs and function chown below!
|
|
|
|
|
zizzzz wrote: but if I create a class to this control and not a member variable
Sorry, but I still don't understand... What do you mean by creating a class to this control ?? Simply declaring an instance of your class outside your view class ? But, why do you want to do that, that's the real problem ! An activeX is a control (it inherits from CWnd), so it will be displayed on your view, dialog, ... So, it is logical that it is a member variable of your view or dialog. Why do you want it to be outside of your class ?
|
|
|
|
|
ok thank's I understand where is the prob
zizzzzzzzzzzzzzz
|
|
|
|
|
I want to hide the drive name during runtime.I have displayed a directory tree in a tree control.The code looks like this,
CString str = ((CIFlappApp *)AfxGetApp())->m_strAppDrive;
str+="\:";
str+="\\";
str+="MyFavourites";
CString str1 = str;
CreateDirectory(str,NULL);
str+="\\";
CString sub = str+"Online Bookmarks";
CreateDirectory(sub,NULL);
sub= str+"Music";
CreateDirectory(sub,NULL);
sub= str+"Pictures";
CreateDirectory(sub,NULL);
sub= str+"Documents";
CreateDirectory(sub,NULL);
m_bookmark.PopulateTree(str1);
Now when i run the application the tree is displayed like this,
D:\My Favourites
Documents
Music
OnLine Bookmarks
Pictures
I want to displat the tree like this.
Favourites
Documents
Music
OnLine Bookmarks
Pictures.
How can i do this.Can anyone help me in this.
Thanks.
|
|
|
|
|
Hi Radhika,
You can use string manipulations to remove the prefix of drive letter. There are so many helpful functions in CString class.
|
|
|
|
|
I add sth based on your code follow:
CString drv = ((CIFlappApp *)AfxGetApp())->m_strAppDrive;
drv+="\:";
drv+="\\";
CString str = drv + "MyFavourites";
CString str1 = str;
CreateDirectory(str,NULL);
str+="\\";
CString sub = str+"Online Bookmarks";
CreateDirectory(sub,NULL);
sub= str+"Music";
CreateDirectory(sub,NULL);
sub= str+"Pictures";
CreateDirectory(sub,NULL);
sub= str+"Documents";
CreateDirectory(sub,NULL);
str1.TrimLeft(drv);
m_bookmark.PopulateTree(str1);
freeman
|
|
|
|
|
radhika28 wrote:
I want to hide the drive name during runtime.I have displayed a directory tree in a tree control.The code looks like this,
CString str = ((CIFlappApp *)AfxGetApp())->m_strAppDrive;
str+="\:";
str+="\\";
str+="MyFavourites";
CString str1 = str;
CreateDirectory(str,NULL);
str+="\\";
CString sub = str+"Online Bookmarks";
CreateDirectory(sub,NULL);
sub= str+"Music";
CreateDirectory(sub,NULL);
sub= str+"Pictures";
CreateDirectory(sub,NULL);
sub= str+"Documents";
CreateDirectory(sub,NULL);
m_bookmark.PopulateTree(str1);
Now when i run the application the tree is displayed like this,
D:\My Favourites
Documents
Music
OnLine Bookmarks
Pictures
I want to displat the tree like this.
Favourites
Documents
Music
OnLine Bookmarks
Pictures.
How can i do this.Can anyone help me in this.
could you show me piece of code , which you are using to populate item in TreeCtrl
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
hi all,
I am developing an application which moniters devices connected to usb port.. Application should allow only particular devices ... for other devices it has to block those devices with out accessing it by user?
Any suggestions????
|
|
|
|
|
How can I know if an application has started a DirectX "window" and then kill it?
Thank you!
modified 9-Mar-17 17:08pm.
|
|
|
|
|
Can you be more specific.
|
|
|
|
|
Let us say a progam starts a DirectX window. I want to write a process that can detect all directX windows started and kill them.
modified 7-Mar-17 16:45pm.
|
|
|
|
|
Hi all,
I was wondering if someone could help me with the following problem that is occuring.
The thing is that every now and again a computer of mine, gives a message that the computer has run out of resources. So the thing is, is there any way I can handle such an event in VC++. When I try to connect to that PC throught PC Anywhere, I can't because of this message.
Can anyone help???
Thank you in advance
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Hi Programm3r,
You could use task manager to identify which process is abusing system resources.
And then try running Perfmon on your test pc and add various counters (for the failing process) to see why its running out of resources.
Add:
Virtual Memory
Private Bytes
Handles
regards,
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
In MFC how to achieve the functionality of selecting the multiple files . That is pressing control button multiple files can be selected.
Regards
Shikha
|
|
|
|
|
Do you need to CFileDialog class
|
|
|
|
|
You will need to use the CFileDialog class for that, as whitesky already said. To be able to select multiple files, the m_ofn.Flags should have the OFN_ALLOWMULTISELECT flag set.
The nail that stands out will be hammered down - Japenese proverb
|
|
|
|
|
I am using this code to insert data in databse,BY DOING oledb CONNECTION WITH DATABSE.....
can anybody help to get what i am doing wrong here.....i have made comment line error occure
ERROR is : cannot convert from 'unsigned short [139]' to 'char []'
<br />
HRESULT hr;<br />
hr = CoInitialize(NULL);<br />
CDataSource connection;<br />
CSession session;<br />
CCommand<CAccessor<CTQuoteAccessor> > TQuote;<br />
CDBPropSet propset(DBPROPSET_DBINIT);<br />
<br />
propset.AddProperty(DBPROP_AUTH_CACHE_AUTHINFO, true);<br />
propset.AddProperty(DBPROP_AUTH_ENCRYPT_PASSWORD, false);<br />
propset.AddProperty(DBPROP_AUTH_MASK_PASSWORD, false);<br />
propset.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR(""));<br />
propset.AddProperty(DBPROP_AUTH_USERID, OLESTR("Admin"));<br />
propset.AddProperty(DBPROP_INIT_DATASOURCE, OLESTR("C:\\MyDocuments\\ODLData.mdb"));<br />
propset.AddProperty(DBPROP_INIT_MODE, (long)16);<br />
propset.AddProperty(DBPROP_INIT_PROMPT, (short)4);<br />
propset.AddProperty(DBPROP_INIT_PROVIDERSTRING, OLESTR(""));<br />
propset.AddProperty(DBPROP_INIT_LCID, (long)1033);<br />
hr = connection.Open(_T("Microsoft.Jet.OLEDB.4.0"), &propset);<br />
hr = session.Open(connection);<br />
<br />
CCommand<CAccessor<CTQuoteAccessor> >cmd;<br />
CCommand<CDynamicAccessor,CRowset>commandInsert;<br />
<br />
TCHAR tszSQL[] = L"INSERT INTO TQuote (m_ID,m_DateTimeStamp,m_MarketNo,m_MarketName,m_Bid,m_Ask,m_MarketState) VALUES (Sessionid,Timestamp,a,Market,Bid,Ask,d)";<br />
<br />
hr = commandInsert.Open(session,(LPCTSTR) tszSQL,NULL,NULL,DBGUID_DBSQL,false);<br />
hr = session.Commit();<br />
<br />
CDialog::OnOK();<br />
<br />
A Million Thanks for any support
|
|
|
|
|
abrakadbra wrote: TCHAR tszSQL[] = L"INSERT INTO TQuote (m_ID,m_DateTimeStamp,m_MarketNo,m_MarketName,m_Bid,m_Ask,m_MarketState) VALUES (Sessionid,Timestamp,a,Market,Bid,Ask,d)";
use _T("") instead of L
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
After using _T("") this error :
fatal error C1057: unexpected end of file in macro expansion
|
|
|
|
|
abrakadbra wrote: TCHAR tszSQL[] = L"INSERT INTO TQuote (m_ID,m_DateTimeStamp,m_MarketNo,m_MarketName,m_Bid,m_Ask,m_MarketState) VALUES (Sessionid,Timestamp,a,Market,Bid,Ask,d)";
why not you simple use
CString tszSQL=T("INSERT INTO TQuote (m_ID,m_DateTimeStamp,m_MarketNo,m_MarketName,m_Bid,m_Ask,m_MarketState) VALUES (Sessionid,Timestamp,a,Market,Bid,Ask,d)");
as CString overload Const STring operator
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief And You
|
|
|
|
|
Hi,in my appliaction am using tree control which display files and folder of mycomputer , now i want is when i select images , thos images preview or thumbnail to be displyed in the form of outside tree control.
|
|
|
|
|
You can use of a CListCtrl
|
|
|
|
|
kiranin wrote: Hi,in my appliaction am using tree control which display files and folder of mycomputer , now i want is when i select images , thos images preview or thumbnail to be displyed in the form of outside tree control.
try extended List Ctrl here http://www.codeproject.com/listctrl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|