|
Hello all,
I have an Activex Control in vc++ 6.0.It is a player plays cam files.
I have designed in the way that everytime the Activex control opens ,cam file will be downloaded from the server(Download Dialog) and after downloading the download dialog is closed automatically using OnThreadFinished.
LRESULT CHttpDownloadDlg::OnThreadFinished(WPARAM wParam, LPARAM /*lParam*/)
{
m_bSafeToClose = TRUE;
m_ctrlAnimate.Stop();
if (m_bAbort)
EndDialog(IDCANCEL);
else if (wParam)
{
AfxMessageBox(m_sError);
EndDialog(IDCANCEL);
}
else
EndDialog(IDOK);
return 0L;
}
OnThreadFinished is for closing the dialog after the cam file downloads
fully.
1.Is ther any method to close the dialog while downloading the file.
Help me please and give me ur suggestions.
thanks in advance
Sunita
|
|
|
|
|
hi ,
what is the meaning of #pragma pack ?
From MSDN I came to know that it specifies the packing alignment for structure and union members .
But what is meant by packing alignment ?
Can you please tell me.
Thanks in advance
|
|
|
|
|
If you declare a struct with
char dummy;
short x;
long y;
members, the "optimal" size would be 1 + 2 + 4 (assume x86 for the moment).
However, this would be with alignment of 1. This says what byte boundary you use for packing. With an alignment of 2, each member begins on the next available 2 byte boundary, so the single char would be followed by an unnamed pad byte, the short would already be aligned correctly, as would the long.
Similarly with 4 byte, the char is followed by 3 unnamed pad bytes, the short by another two, and the long would be OK as is.
I can almost hear you asking "Why would I want to waste memory like that?"
[fx: pause for reader to actually ask...]
It's all to do with the way the processor accesses memory, and for some CPUs, like the SPARC, trying to access a packed (1) long would cause an exception.
The important thing is to consistently use the same alignment for all in memory versions of a structure. For instance, if you build a DLL with a function that takes a structure, the declaration of that structure should really include
#pragma pack(push)
#pragma pack(n)
struct {
....
};
#pragma pack(pop)
so that irrespective of the compile time options elsewhere, it has the packing n (where n is a power of 2). Without this, you might build the DLL with pack(2), for instance, and a client might be built with pack(1). This would misalign the data, and might even result in an access violation when you call the DLL function.
Does that help?
Steve S
Developer for hire
|
|
|
|
|
Thank you very much for your reply
|
|
|
|
|
Hi.
I'm developing MFC Activex library, which deals with data from MS Access DB. I need to make function like
short GetTagStruct(short nTag, VARIANT *arrayTagStruct) - .odl file in vc6++
I want to call this interface function in VB.
Structure can be for example:
<br />
Public Type TagStruct<br />
sTagName As String<br />
x As Single<br />
y As Single<br />
sObjName As String<br />
sDispPath As String<br />
sDispName As String<br />
End Type<br />
I know how to handle BSTR array in Variant, but I don't know what type I should select for safearray of user defined structure. For BSTR it is VT_ARRAY | VT_BSTR.
Can you give me example of using safearray of user defined structure stored variant ?
Thanx.
rudo
|
|
|
|
|
The Variant type used for this VT_ARRAY | VT_UI1 means a SafeArray of Unsigned Bytes. Which further means that this is simple binary data which you are storing in a variant.
"Some people believe football is a matter of life and death.
I'm very disappointed with that attitude.
I can assure you it is much, much more important than that. -- Bill Shankly"
|
|
|
|
|
Hi,
You can use VT_RECORD, if you define your structure as a UDT (user defined data type). See the MSDN for details on this topic.
Regards,
Tim
|
|
|
|
|
I can't write using Excel=Microsoft.Office.Interop.Excel namespace my .NET editor. What can I do for this problem. I am using Office 2003 and I added Microsoft.Excel 11 Object Library and Microsoft Office 11 Object Librry.
For your answers tnahk you ....
This is my sign
|
|
|
|
|
Hi All,
Im writing a dll in ATL COM called by a vb.net client. the client passes a 2d integer array when it calls MyMethod.
i have tow problems
I. i have trouble accessing the values in the array passed, i get junk values. this is the code.
<br />
STDMETHODIMP ExposedATLClass::MyMethod(SAFEARRAY **psa)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
long arrlengthx,arrlengthy;<br />
long **myarray;<br />
int indexx,indexy;<br />
try<br />
{<br />
arrlengthx=(*psa)->rgsabound[0].cElements;<br />
arrlengthy=(*psa)->rgsabound[1].cElements;<br />
myarray=(long**)malloc(arrlengthx*sizeof(long**)); <br />
for(long tempvar=0;tempvar<=arrlengthx;tempvar++)<br />
{<br />
myarray[tempvar]=(long*)malloc(arrlengthy*sizeof(long*));<br />
}<br />
SafeArrayAccessData(*psa,(void**)myarray);
char details[100];<br />
for(int tempx=0; tempx<=arrlengthx; tempx++, indexx++, indexy=0)<br />
{<br />
for(double tempy=0; tempy<=arrlengthy; tempy++, indexy++)<br />
{<br />
sprintf(details,"%d %d %d",indexx,indexy,myarray[indexx][indexy]);<br />
this->Error_Logger(details);
}<br />
}<br />
}<br />
catch(CException ex)<br />
{<br />
char error[300];<br />
ex.GetErrorMessage(error,300);<br />
this->Error_Logger(error);<br />
ex.Delete();<br />
}<br />
return S_OK;<br />
}<br />
in the program
SafeArrayAccessData(*psa,(void**)myarray); returns success
other methods i've used to access data are (replace the line "SafeArrayAccessData(*psa,(void**)myarray);" with code below )
1. using SafeArrayGetElement
<br />
long ai[2]={0,0}<br />
for(int temx=0;temx<=arrlengthx;temx++,ai[0]++)<br />
{<br />
for(int temy=0;temy<=arrlengthy;temy++,ai[1]++)<br />
{<br />
SafeArrayGetElement(*psa,ai,&myarray[temx][temy]);<br />
}<br />
}<br />
here SafeArrayGetElement(*psa,ai,&myarray[temx][temy]); returns index out of bounds
2. using safearraylock/unlock
<br />
<br />
both lock and unlock returned success
all methods return this junk value for myarray[indexx][indexy] -842150451
the values of indexx and indexy are correct and so are the boundaries.
II. my other problem.. no exception is logged.
where am i wrong. pls help
Thanks in advance
Nikhil
|
|
|
|
|
Hi,
I want to Change GUID, Which generated by vc++, First I want to delete that GUID and Than want to set new GUID.
Thanks in Adv.
Regards,
RRRB
-- modified at 7:17 Thursday 20th July, 2006
|
|
|
|
|
Hi,
you can use GUIDGEN.exe
this should be present in the visual studio folder.
regards
nikhil
|
|
|
|
|
Thanks ,But First I want to delete the GUID Which is generated by vc++, After that I want to set my own guid for the same.
Looking forward....
|
|
|
|
|
u can use GuidGen tool which ships with visual studio and replace it in the idl file.
-- modified at 9:09 Wednesday 26th July, 2006
|
|
|
|
|
I have a componant and its idl file. I have included its header file in my stdafx.h and added the .c file into my project with addtoproject file. Actually that .c file containd actual definition of all IIDs and CLSIDs. Now its showing error. End file while looking for precompiled header. What to do now. Actually i dont have a clear idea how to use the classes defined in that componant.
Please tell me how to do that.
KIRAN PINJARLA
-- modified at 3:41 Thursday 20th July, 2006
|
|
|
|
|
I can help you with the first error;
You need to alter your project settings for the .c file so that it specifies "Not using precompiled headers".
If you're using VC6, you can right-click on file in FileView and select settings, you need C++ tab, category 'precompiled headers'. HINT: change it for 'All configurations' or you'll forget later!
Can't tell you how toi use the classes, since I have no idea what component you have. General stuff though :-
Make sure that you call either OleInitialize (or AfxOleInit if it's an MFC app) or CoInitialize/CoInitializeEx, or you won't be able to do anything.
To get an interface to an instance of the component, you need to call
CoCreateInstance( CLSID_xxxxx, NULL, CLSCTX_ALL, IID_zzzzzz, reinterpret_cast<void**>(&ptr));
where you have IMyInterface* ptr;
Check your return codes, and of course, if that works, eventually you'll need to call
ptr->Release();
Enjoy
Steve S
Developer for hire
|
|
|
|
|
Thank you Steve.It worked. I will try to use that componant and if got struck I hope u r there to help.
Thank You
KIRAN PINJARLA
|
|
|
|
|
i need to add Flexgrid in the ActiveX component is this posible how?
chetan
-- modified at 1:59 Thursday 20th July, 2006
|
|
|
|
|
try creating a composite dialog in activex.
-Prakash
|
|
|
|
|
//IDispatch wrapper class(es)
// .h file
class CAPI : public CWnd
{
public:
CString Login(LPCTSTR UserName, LPCTSTR Password, LPCTSTR UserId);
}
// .cpp file function
CString CAPI::Login(LPCTSTR UserName, LPCTSTR Password, LPCTSTR UserId)
{
//username = wwtest2;
//Password = RD9234;
//Userid = wwtest2;
CString result;
static BYTE parms[] =VTS_BSTR VTS_BSTR VTS_BSTR;
InvokeHelper(0x2, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms,UserName, Password, UserId);
return result;
}
"God helps to whom who helps other"
|
|
|
|
|
If any body has used Netmeeting sdk please reply
I need help.
thank you
KIRAN PINJARLA
|
|
|
|
|
Actually Netmeeting COM has an Interface INmManager. I want to use it. and teh header file given for that is inmconf2.idl. If i am includeing using #include <inmconf2.idl> i am getting errors and its showing errors in idl file.
How to debug it
Please help me
KIRAN PINJARLA
|
|
|
|
|
Hi All,
My requirements needs me to pass an instance of a class xyz in a third party component(OCX) to my dll in ATL COM. how do i go about this?
We all know that passing parameters in the constructors of the exposed atl classes/objects is literally impossible unless i write my own atl library(oops sorry bad joke!).
That means the only option i have is to pass this third party component
instance to a method, i hope this is possible, even if it is, how do i define
the 'xyz' data type in the idl file?
<br />
import "oaidl.idl";<br />
import "ocidl.idl"; <br />
[<br />
object,<br />
uuid(AB375A74-76CB-4BBC-BFED-141791262B38),<br />
dual,<br />
helpstring("IExposedATLClass Interface"),<br />
pointer_default(unique),<br />
oleautomation<br />
]<br />
interface IExposedATLClass : IDispatch<br />
{<br />
[id(1), helpstring("method GetInstance")] HRESULT GetInstance([in] Ixyz *instance);<br />
};<br />
<br />
[<br />
uuid(3C9EB277-EC91-4E42-8CD7-34F918490B69),<br />
version(1.0),<br />
helpstring("MYDLL 1.0 Type Library")<br />
]<br />
library MYDLLLib<br />
{<br />
importlib("stdole32.tlb");<br />
importlib("stdole2.tlb");<br />
importlib("thirdpartycomponent.tlb");<br />
<br />
<br />
[<br />
uuid(4DC3999A-797D-4F9A-8955-812E87E4B6D0),<br />
helpstring("ExposedATLClass Class")<br />
]<br />
coclass ExposedATLClass<br />
{<br />
[default] interface IExposedATLClass;<br />
};<br />
};<br />
the compiler doesnt recognize the xyz data type...
i import the component(OCX) in my stdafx.h file, my idl file imports the midl compiler generated .tlb file in my library namespace, after all this when i try importing the component's idl file in my idl
<br />
import "oaidl.idl";<br />
import "ocidl.idl"; <br />
import "thirdpartycomponent.idl";<br />
the compiler reports ambiguous symbols.
what should i do?
I'd really appreciate any kind of help/suggestion here.
nikhil
|
|
|
|
|
Hi All,
I am working on distributed application project in VC++. In my project, I am facing problem in debugging COM+ DLL (i.e ATL-COM DLL with MTS) project module. I want to debug one function inside this COM+ DLL. The function that I want to debug is called by windows service project module(i.e myproject.exe which is run as service on the same machine where COM+ DLL is registered.)
To debug this COM+ DLL, I compile both COM+ DLL project module and windows service module(i.e myproject.exe ) in debug mode with appropriate break points. In MS Visual C++ IDE, project setting option for COM+ DLL project module, under “executable for debug session” I added path for debug version of windows service EXE (i.e myproject.exe).
The Problem is, “when I trying to debug COM+ DLL module by pressing F5, it invokes the myproject.exe and stops at statement in windows service EXE (i.e myproject.exe) which is calling function inside the COM+ DLL that I want to debug. But when I press “Debugstep Into” or F11 to debug the COM+ DLL code, it is unable to link to COM+ DLL code and returns only return value from function inside COM+ DLL that I want to debug”
You can reach me on nimesh2611@rediffmail.com
Can any one tell me what other setting required under Project setting in VC++ IDE.
Or
Can you tell me some other approach to debug this COM+ DLL ?
Or
Send me some related links or document that helps me out…
Thanks
Nimesh patel.
Nimesh
|
|
|
|
|
NEED HELP WITH WORKING IMAPI OBJECTS
hi,
I want to work with IMAPI INTERFACES. I am
working in win xp with sp2 installed in Visual C++ 6.0 environment.
I wrote a sample code just to access IDiscmaster interface ptr.
The error comes in CoCreateInstance. I searched in my hard disk IMAPI.H i cannot find it. so
//CLSID CLSID_DISCMASTER;
//HRESULT hr = S_OK;
//hr = CoCreateInstance(CLSID_DISCMASTER, NULL, 1, IID_Unknown, (void**) ppUnk);
//or i tried this also
//hr = CoGetClassObject(CLSID_DISCMASTER,CLSCTX_INPROC_SERVER, NULL, IID_IClassFacory, (void**) &ppCf);
//Both are failing why
can u just help me regarding this.
thank you,
A beginner
|
|
|
|
|
You need the Feb 2003 Platform SDK, which was the last issue 'guaranteed' to work with VC6.
I believe you can download it from here[^]
Steve S
Developer for hire
|
|
|
|
|