|
You will have to write a BHO(Browser Helper Object).
You can start from here[^]msdn
Also look for BHO samples here in codeproject also.
There is no spoon.
mail
|
|
|
|
|
Thank you suhredayan very much for your kind help. I'm searching in codeproject for the sample code.
I will go back to this topic if there are some confusion to me and need your help again.
Once again, thank you.
|
|
|
|
|
you are welcome TPN.
There is no spoon.
mail
|
|
|
|
|
Hi!
I’m creating an ActiveX control in my myapp.aspx-page using the <object> - tag.
<br />
<OBJECT id="objComp" style="Z-INDEX: 101; LEFT: 24px; WIDTH: 974px; POSITION: absolute; TOP: 40px; HEIGHT: 538px"<br />
</OBJECT><br />
At this time I’m only using the ActiveX technology to publish my MFC application on the net. I’m about to make a call to may webpage like this:
http://www.mypage.com/myapp.aspx?user=bill&password=12345
How may I pass the “user” and the “password” into my ActiveX?
Can I how do I access the properties of my ActiveX from my page?
The ActiveX is supposed to run on the client – not on the server.
_____________________________
...and justice for all
APe
|
|
|
|
|
hi
ya its for sure that ActiveX runs on client side
you can access methods as well as properties exposed by your control from your page
e.g. if your control exposes a method like SetUseridPassword(BSTR usrID,BSR password) then you can access it as follows
<OBJECT
ID="MyActiveXID"
CLASSID="clsid:your-control-class-id-here"
CODEBASE="TestAX.ocx"
TYPE="application/x-oleobject"
>
then on any event (like button's onClick) call the following following function like onClick='InitValues'
don't forget to define this script in head section of your page.
<script language="JavaScript">
function InitValues()
{
MyActiveXID.SetUseridPassword("testusr","tstpassword")
}
</script>
Muhammad Azam
|
|
|
|
|
It really looks like you have the solution of my problem. I try to implement it with javascript.
THANKS!
_____________________________
...and justice for all
APe
|
|
|
|
|
hi
its my pleasure if i could be of any help for you
regards
Azam
|
|
|
|
|
Hi All,
I used SuspendThread and ExitInstance to stop a thread created using AfxBeginThread Function. But in some newsgroup messages it is stated that this is not the right method. I've used PostThreadMessage using WM_QUIT, but this is not working. So How to stop a thread created using AfxBeginThread function.
Thanx in Advance
Sujan
|
|
|
|
|
To use PostThreadMessage it should be a UI Thread with message loop. Wot kind of thread you created worker thread or UI thread ?
There is no spoon.
mail
|
|
|
|
|
Hi suhredayan,
Thanx for your reply.
It's a worker thread. TerminateThread is working but i am using critical
section for data handling, so MSDN states that it is a DANGEROUS function. Think that i must have to use waitforsingleobject().
Sujan
|
|
|
|
|
The thread must finish execution on its own based on some condition. Use WaitForSingleObject or WaitForMultipleObjects if you got wait for some signal and u can also give time. There are other methods also that can be used to stop execution like signalling a flag etc.
|
|
|
|
|
Hi Dubey,
Thanx 4 ur reply.I'll try to implement it using waitformultipleobjects.
Sujan
|
|
|
|
|
|
Hi
Thanx for the link i'll look into it
Sujan
|
|
|
|
|
You could create a shutdown event to stop the worker thread execution.
Here's an example how to do it:
int CYourThreadClass::ThreadFunction()
{
while(1)
{
HANDLE h[2];
h[0] = m_eventShutdown.m_hObject;
h[1] = another handle;
DWORD dwRet = ::WaitForMultipleObjects(2,h,FALSE,YOURTIMEOUT)
if(dwRet==WAIT_OBJECT_0)
return 0;
else if(dwRet==WAIT_OBJECT_1)
else if(dwRet==WAIT_TIMEOUT)
else if(dwRet==WAIT_FAILED)
}
}
|
|
|
|
|
Hi Markowski
Thanx a lot. I am working with it.
Sujan
|
|
|
|
|
Hi Andrzej
One silly question. Sorry. How to manage with WAIT_OBJECT_1.Instead shall i use the created thread handle. I used it and it is always getting into that "Wait Timeout" state. OR have to create another event.
Thanx in advance
Sujan
|
|
|
|
|
Here's an example which manages with WAIT_OBJECT_1 . The example demonstates how to print to the debug output every 1 s:
int CYourThreadClass::ThreadFunction()
{
while(1)
{
int nCounter = 0;
HANDLE h[2];
h[0] = m_eventShutdown.m_hObject;
h[1] = m_eventPrintToDebug.m_hObject;
DWORD dwRet = ::WaitForMultipleObjects(2,h,FALSE,INFINITE)
if(dwRet==WAIT_OBJECT_0)
return 0;
else if(dwRet==WAIT_OBJECT_1)
TRACE("Counter = %d\n",n_Counter++);
else if(dwRet==WAIT_TIMEOUT)
else if(dwRet==WAIT_FAILED)
}
}
|
|
|
|
|
Hi Andrzej,
Thanx A Lot. I am working with it.
Actually i creating a number of threads using AfxBeginThread(..) function and trying to end them.
The code goes like this
CWinThread *multthreads[MAX_CONNECTIONS];
int count;
UINT DataAccessThreading(LPVOID pParam)
{
CoInitialize(NULL);
int* ind= (int *)pParam;
int index=*ind;
free(ind);
while(TRUE)
{
HANDLE h[2];
h[0] = m_eventShutdown.m_hObject;
h[1] = multthreads[count]->m_hThread;
DWORD dwRets = (DWORD) multthreads[count]->m_hThread;
DWORD dwRet = ::WaitForMultipleObjects(2,h,FALSE,INFINITE);
if(dwRet==WAIT_OBJECT_0)
{
TRACE("THREAD EXIT SUCCESSFULL-Not Killing \n");
return 0; //exit thread
}
else if(dwRet== (DWORD) multthreads[count]->m_hThread)//handle your synchronization object
{
test.CacheRefresh(index);
Sleep(refreshInterval); //Added by Sujan
}
else if(dwRet==WAIT_TIMEOUT)//handle timeout
{
TRACE("Wait Timeout \n");
}
else if(dwRet==WAIT_FAILED)// handle error
{
TRACE("Wait Failed \n");
}
}
return 0;
}
and the OnInitDialog i am creating a thread by using
int *p=(int *)malloc(sizeof(int));
*p=i;
multthreads[i]=AfxBeginThread(DataAccessThreading,p,0,0,NULL);
Am i going on the right way. Please comment on this.
While using this code i am not getting my event called at all.
SORRY FOR DISTURBING YOU.
AGAIN Thanx A Lot
Sujan
|
|
|
|
|
Hi Andrzej,
If you have got the problem with my code. I am waiting for your responce.
SORRY 4 DISTRUBING U Much
Sujan
|
|
|
|
|
Does this article help?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes Yes
Thanx David. Now i am working with it.
Sujan
|
|
|
|
|
Ok this has to be obvious, but somehow I must be missing something somewhere...
I made a dialog and on it I placed a static control with a bitmap on it (in the resource editor). All well, but when I want to change the bitmap displayed on the control, the control vanishes(does not get redrawn)...
I tried to create a CStatic control on the stack, but that one never shows... What`s wrong with this code?
This is placed in the OnInitDialog of the dialog:
m_statTest.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, tmprect,this);
m_statTest.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_MYBITMAP)));
The m_statTest control is never displayed ( and yes, the tmprect is inside the CDialog frame)...
Another CStatic control that I created with the classwizard from a CStatic on the Dialog resource, also disapears when I call the SetBitmap on it...
My bitmap has 256 colors, might that be the prob??? (although it does display correct when I never use the setbimap on the control added in the resource editor)
Any help is greatly appreciated...
Davy
|
|
|
|
|
Use the following code
On the cpp file add the following.
CRect tmprect(100,100,300,300);
m_statTest.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE, tmprect,this);
bm.LoadBitmap(IDB_BITMAP);
HBITMAP hBitmap = (HBITMAP)bm.GetSafeHandle();
m_statTest.SetBitmap(hBitmap);
on the header file create the instance of bm as
CBitmap bm;
This will work
|
|
|
|
|
To make your code working change the first parameter in function ::LoadBitmap from NULL to AfxGetApp()->m_hInstance .
|
|
|
|