|
I have made an ActiveX control (.OCX) for web interface.
It has some member variables. And I had not implemented Get/Set methods for
those variables.
Throught the web page, I can set the values of above variables by <param> tag.
But now, I want to set the values of above variables by container application.
I made MFC application project by VC++. Above ActiveX control is inserted.
But, I cannot find the way to set the values of ActiveX's variables by the
same way as the <param> tag.
I think there is the way to set value to these variables because the Internet
Explorer can set without Get/Set methods.
How can I set the values of ActiveX's variables?
Please understand my poor English. English is not my mother tongue.
Following codes are some piece of my ActiveX control.
//################## SampleCtrl.cpp #########################
.........
void CSampleCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);
// TODO: Call PX_ functions for each persistent custom property.
PX_String(pPX,_T("sUserID"), strUserID );
PX_String(pPX,_T("sVerifyCode"), strVerifyCode );
PX_Short(pPX,_T("nLevel"), nLevel );
}
........
// ############## SampleCtrl.h #####################
class CSampleCtrl : public COleControl
{
....
private:
short int nLevel;
CString strVerifyCode;
CString strUserID;
};
// ############## test.html ####################
<OBJECT ID="Sample" WIDTH=340 HEIGHT=150 CLASSID="CLSID:D870D8B9-16CC-4445-9BE3-36BDFF5621E6">
<PARAM NAME="sUserID" VALUE="superman">
<PARAM NAME="sVerifyCode" VALUE="K4HVD-Q9TJ9-6CRX9-RQ2D3">
<PARAM NAME="nLevel" VALUE="3">
</OBJECT>
-- modified at 6:22 Thursday 24th November, 2005
|
|
|
|
|
If its your ActiveX control, then expose the variables using Properties. Create a new property for each of the variable and the IDE will generate the Getter and Setter.
From your HTML / Javscript code, you can directly access the variable using the property name as they are using IDispatch. From your VC++ code, you can use Getter and Setter methods.
Cheers
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thank you for your reply.
Yes, the ActiveX control is made by me.
But, I don't want to modify the ActiveX control at all.
Just I want to know how can access it's variables as the Internet Explorer.
If I will modify my ActiveX control, I can solve this problem.
But I cannot find the way to access to such variable without Get/Set methods.
Is there another way to access?
|
|
|
|
|
Hi,
I want to resize a control in list subitem as I increase or decrease
column width.I am handling this in OnCustomDraw() but it is flickering.I want to set SetRedraw() to TRUE and FALSE but in which event should I do that?
|
|
|
|
|
If the flickering occurs when you are resizing, then try calling SetRedraw() in your OnSize() handler.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Hi everyone!
Revising some code I've found this:
for(int i=0; i<m_aArray.GetSize(); i++)<br />
{<br />
...<br />
if(bCondition)<br />
break;<br />
}<br />
<br />
if( i==m_aArray.GetSize())<br />
{<br />
...<br />
}
That caused an ASSERT(HowCanItBe) into my brain. If "i" is declared into the
"for", how is possible to use it later? The code compile right, so Was I
wrong thinking that "i" _is_declared_ into the "for"?
Then, talking with the partners at work someone pointed out that in VS you
can do it, but in C++Builder it wouldn't compile.
The question is
What is the standard? And how are declared that kinds of variables?
And just testing I can do things like
for(int i=0; i<5; i++)<br />
{<br />
...<br />
}<br />
i = 6;<br />
for(int i=7; i<8; i++)<br />
{<br />
...<br />
}
what is the scope then?
Thank you in advance.
Regards.
|
|
|
|
|
I think the actual rule is that:
for (int i = 0; i < 10; i++)<br />
{<br />
}
//now i is invisible here.
But in VC6 it is visible after the for (...)
And I believe in VS .net compiler, they have complied with the standard and local variables are not visible outside anymore.
this is this.
|
|
|
|
|
Gizzo wrote: If "i" is declared into the
"for", how is possible to use it later?
In VS 2005 it's back to normal "i" won't be visible outside for
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
Hello,
I have a piece of c++ code – which I use in a COM DLL which takes a lot of time to execute (about 2 hours). Can anyone point me a good article that shows how to quite code execution after a specified period of time (lets say if method1 takes more than 5 minutes to return data than move forward). I know that this is possible using threads but I am curious if there a different way to solve this issue.
Thank you very much,
Regards,
Dan.
|
|
|
|
|
Respected All
Regards!
The article from Hermann about Print is
"Easy to use class for ScreenCapture to printer"
I used it and working well and i bcome able to take print while using this class brillient work by him but the always the print did not come on the center of the page and that's start print from the Top Left corner of the page, now i want to take Print at the center of the page.
the link of the page is
http://www.codeproject.com/printing/prntscreen.asp
please guide for possible change in this class so that i may able to take print at the middle of the page while printing.
Regards
David
david
|
|
|
|
|
why don't you ask on the forum at the bottom of the article ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
How can I avoid multiple instance of an MFC application? My C++ code didn't kill my application even I write exit(). I don't want to close application from task manager at each time. Any suggestions...
here is the my code that dosn't kill application.exe
try
{
m_pEtmenFed->flag=false;
Disconnect();
// I get an exception here
}
catch(...)
{
}
try
{
//This part doesn't work..
exit(m_nExitCode);
//CDialog::OnClose();
}
catch(...)
{
}
|
|
|
|
|
|
Here is how I solve this problem -> I have read about it on codeproject a few years I think:
In BOOL CXXXApp::InitInstance()
I have this piece of code:
HWND hWnd = ::FindWindow(NULL,"My Application Window Name"); <br />
if (hWnd) <br />
{ <br />
::ShowWindow(hWnd, SW_SHOWDEFAULT);<br />
::BringWindowToTop(hWnd);<br />
::SetForegroundWindow(hWnd);<br />
return FALSE; <br />
}
So if the window is present the new instance will bring it on top and returns FALSE which closes the new instance.
Regards,
Dan.
|
|
|
|
|
micutzu wrote: HWND hWnd = ::FindWindow(NULL,"My Application Window Name");
Oops could lead to hang ups. I did this once it got hung up. The article referred to by toxcct is a good one.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I have taken this error from code referred by toxct
Etmen.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CInstanceChecker::~CInstanceChecker(void)" (??1CInstanceChecker@@UAE@XZ)
Etmen.obj : error LNK2001: unresolved external symbol "public: struct HWND__ * __thiscall CInstanceChecker::ActivatePreviousInstance(void)" (?ActivatePreviousInstance@CInstanceChecker@@QAEPAUHWND__@@XZ)
Etmen.obj : error LNK2001: unresolved external symbol "public: int __thiscall CInstanceChecker::PreviousInstanceRunning(void)" (?PreviousInstanceRunning@CInstanceChecker@@QAEHXZ)
Etmen.obj : error LNK2001: unresolved external symbol "public: __thiscall CInstanceChecker::CInstanceChecker(void)" (??0CInstanceChecker@@QAE@XZ)
Debug/Etmen.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
|
|
|
|
|
Try and get the latest version from PJ's website:
Link[^]
~RaGE();
|
|
|
|
|
Hey,
You have to add those files to the project. You have caopied them, But didn't add them to your project.
The compiler had no problem, since the header files were there in the same folder. But when linking, the object file must have the signatures of the function that you have used in your program.
The errors you have posted means, CInstanceChecker class is not compiled and the manged names are not generated, which made the linker show these errors.
Add those files to your project and everything will work fine.
Cheers
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Below I give my code from the project. I have taken exception in the indicated line, what can be reason for this?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/////////////////////////////////////////////////////////////////////////////
// CEtmenApp initialization
BOOL CEtmenApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
if (instanceChecker.PreviousInstanceRunning())
{
AfxMessageBox(_T("Previous version detected, will now restore it"),
MB_OK);
instanceChecker.ActivatePreviousInstance();
return FALSE;
}
CEtmenDlg dlg;
m_pMainWnd = &dlg;
// If this is the first instance of our App then
// track it so any other instances can find it.
if (!instanceChecker.PreviousInstanceRunning()) //EXCEPTION!!!
instanceChecker.TrackFirstInstanceRunning(); // EXCEPTION!!!!
|
|
|
|
|
MuratMetu wrote: if (!instanceChecker.PreviousInstanceRunning()) //EXCEPTION!!!
dude !!! which exception ????
it works for me, so i still believe you're doing something wrong...
did you included the headers correctly ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I use correct headers, it says 'DEbug Assertion Failed'
The only difference is that I use
CEtmenDlg dlg;<br />
m_pMainWnd = &dlg;
In the example code you use it is written
CMainFrame* pMainFrame = new CMainFrame;<br />
m_pMainWnd = pMainFrame;<br />
<br />
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))<br />
return FALSE;
|
|
|
|
|
I am giving full method that I written
<br />
<br />
BOOL CEtmenApp::InitInstance()<br />
{<br />
<br />
if (!AfxSocketInit())<br />
{<br />
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);<br />
return FALSE;<br />
}<br />
<br />
#ifdef _AFXDLL<br />
Enable3dControls();
#else<br />
Enable3dControlsStatic();
#endif<br />
<br />
<br />
<br />
if (instanceChecker.PreviousInstanceRunning())<br />
{<br />
AfxMessageBox(_T("Previous version detected, will now restore it"), <br />
MB_OK);<br />
instanceChecker.ActivatePreviousInstance();<br />
return FALSE;<br />
}<br />
<br />
<br />
<br />
CEtmenDlg dlg;<br />
m_pMainWnd = &dlg;<br />
<br />
<br />
if (!instanceChecker.PreviousInstanceRunning())<br />
instanceChecker.TrackFirstInstanceRunning();<br />
<br />
<br />
<br />
CString cmdLine = m_lpCmdLine;<br />
CString token = GetNextCmdLineToken(cmdLine);<br />
while (!token.IsEmpty())<br />
{<br />
if (token == '-')<br />
{<br />
token = GetNextCmdLineToken(cmdLine);<br />
if (!token.CompareNoCase("arazi"))<br />
{<br />
dlg.m_araziDizini = GetNextCmdLineToken(cmdLine);<br />
} else if (!token.CompareNoCase("coklu_calisma"))<br />
{<br />
dlg.m_bCokluCalisma = true;<br />
} else if (!token.CompareNoCase("kostur"))<br />
{<br />
dlg.m_bKostur = true;<br />
} else if (!token.CompareNoCase("cc_sunucusu"))<br />
{<br />
m_strCCServer = GetNextCmdLineToken(cmdLine);<br />
}<br />
} else dlg.m_senaryoDosyasi = token;<br />
token = GetNextCmdLineToken(cmdLine);<br />
}<br />
<br />
<br />
int nResponse = dlg.DoModal();<br />
if (nResponse == IDOK)<br />
{<br />
}<br />
else if (nResponse == IDCANCEL)<br />
{<br />
}<br />
<br />
return FALSE;<br />
}<br />
<br />
<br />
|
|
|
|
|
This is not working for your dialog-based application because at the time you call
PreviousInstanceRunning() you do not have a valid window handle for your application.
I suggest you find a mechanism to plug the window handle of your dialog, during OnInitDialog , into the hMainWnd member of the CWindowInstance class. Then it will probably work for you.
Because inside the ActivatePreviousInstance is the call like this:
HWND hWindow = pInstanceData->hMainWnd;<br />
if (hWindow)
And if you understood the code and had single stepped through it, you would find that this handle is probably always NULL (0) and the IsWindow call will fail every time.
|
|
|
|
|
Greetings,
A few friends and I have recieved funding for a project that we are working on. We're still in the planning stages but we've hit a stone wall. We've ordered 2 new IBM eServers that arrive in a few months to experiment on. Only problem is, none of us have experience writing server applications that need to ultilise more than 1 server. I was wondering if anyone might be able to recommend any good books on the subject?
Any help will be greatly appreciated,
Thank you,
Gordon R. Speirs
|
|
|
|