|
Hi
I would like to add a new observation with the above mail.
The problem is seen only in the Debug Mode. The first line in the that method ("assert(false);"), which enables debugging was commented out and its not throwing any more Exception and working fine.
//Server side in VC++
STDMETHODIMP CServerObj ::CallServerMethod(int integer, tagStruct *pVal, VARIANT vt)
{
//assert(false);
}
But I don't know why it was happening.
Regards,
Diana.
|
|
|
|
|
Hi
I am writing a WMI application to monitor the file system events in my system.i had converted the query given in http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0404.mspx" into a WQL in c++. But i am getting an error message Query execution failed. Can anyone help me in this regard.
Is it possible to monitor the entire system for file system changes using WMI ?
|
|
|
|
|
Hi there. I've placed a shockwave flash object on a vc++ dialog and I want to completely eliminate the popup menu which appears under the mouse right click but the flash ocx doesn't have any method to handle the mouse clicks and the menu always pops up. Anyone got any idea?
... And nothing else matters!
|
|
|
|
|
I'm having serious problems trying to insert data into a ms access database. everytime i submit the data, they don't get inserted into my ms access table. I think I don't have permission to insert data into the ms access table, but I don't know how to change the settings so that I can just simple insert data into my table. Any help as to the step-by-step procedure to solve my problem will be received with great thanks
here's the code. the actual form part is from another asp page. This page does the actual inserting of data into table:
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Forum"
set rs=Server.CreateObject("ADODB.recordset")
%>
<%
sql="INSERT INTO forum1 (PosterName,Date,Comments,"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("name") & "',"
sql=sql & "('" & Request.Form("date") & "',"
sql=sql & "'" & Request.Form("comment") & "')"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("No update permissions!")
else
Response.Write("" & recaffected & " record added")
end if
conn.close
%>
jibybabu
|
|
|
|
|
Can Anybody help me in solving this COM problem
I have Created a .Net Windows application in C#.
This application has only a WebBrowser Control. On the Form load event I have navigated to a particular site. (Say www.google.com).
Now I have an Another application that is intended to send keys to this Application.
I’m Using SendKeys.Send () fn. for this.
To my Surprise the webBrowser control is not receiving any of the keystrokes, however the TAB key is working in it.
Then I Opened a normal InternetExplorer page and tried the same. Then that application is receiving keystrokes. I want to know why the webBrowser control (C# application) is not receiving keystrokes.
I will be very grateful to you if u help me in this problem.
Thank you,
Arun Appukuttan
THANK YOU
|
|
|
|
|
try sendkeywait() method..
just a guess..
Good LUck
|
|
|
|
|
Dear Sufyan_shani
using SendKeys.SendWait() fn will not solve the problem. This Problem became a great overhead to me. If any body can help me in this regard i will be very thankfull.
Thank You in advance
Arun Appukuttan
THANK YOU
|
|
|
|
|
Hi,
I made a com component in C# but I don't know how to call it from a VC++ environment(the steps to register it ,etc..)
Thanks
emmy
|
|
|
|
|
Hello meesho,
Just like a normal COM DLL or EXE, a .NET module which has been wrapped as a COM module needs to have its information written into the registry in order for the COM sub-system to locate it and load it into memory for a client.
REGASM.EXE
----------
This is achieved via the REGASM.EXE utility. REGASM performs similarly to the well-known REGSVR32.EXE utility which is used to register COM modules. REGASM uses the metadata contained inside a .NET assembly to generate COM-equivalent information which are then used to insert entries into the registry.
The entries written into the registry include the CLSIDs and ProgIDs of .NET classes which are exposed as COM classes. This registration process is important for COM clients in the discovery and loading process.
Call the REGASM.EXE utility inside the Visual Studio .NET command prompt as folows :
regasm <.NET DLL Assembly Name> /tlb
The "/tlb" flag commands REGASM.EXE to produce a Type Library File (.TLB) for the .NET Assembly. It is useful for your VC++ client to import.
In your VC++ code, you import the .TLB file using the #import keyword, e.g. :
#import "(TLB file path)";
GACUTIL.EXE
-----------
Next, for ease of discovery and loading by the .NET CLR engine, your .NET DLL Assembly -should- be registered into the GAC (Global Assembly Cache). This is not 100% required but will make life must easiler for your client apps.
In order that a .NET module be registered to the GAC, it needs to be digitally signed. This requires a Strong Name Key (SNK) file. You can create an SNK file using the "sn.exe" .NET utility.
Another step to take is to set the path of the SNK file in the AssemblyKeyFile attribute in the AssemblyInfo.cs file :
[assembly: AssemblyKeyFile("..\\..\\KeyFile.snk")]
To register an assembly into the GAC, we use the GACUTIL.EXE utility. For example :
gacutil -i <.NET DLL Assembly Name>
An alternative to using GACUTIL.EXE is to copy your DLL Assembly into a folder location that can be discovered by the .NET CLR.
Give it all a try, meesho. Let me know if you need further clarifications.
Best Regards,
Bio.
-- modified at 2:24 Friday 9th December, 2005
|
|
|
|
|
i have a question regarding article
Component-Based Development with Visual C#
By Wiley Technology Publishing
http://www.codeproject.com/books/0764549146_8.asp
now i want to have drag and drop support with web browser control, plz guide me which interfaces should i implement.
i have xml data in treeview control, now i want to design my own html page with xml data , how do i drag and drop xml element on web browser control
plz help me
fahad
|
|
|
|
|
Can any one tell me the good e-book or any book for learning ActiveX Programming with the combination of VB or C++.this should be usefull for begining level and also programable.
N.Rajakumar B.E.,
Application Developer,
|
|
|
|
|
Start with MS MSDN, in that go to Contents tab and "Inside OLE" partial book is available.
|
|
|
|
|
Guys,
I am an accomplished embedded coder, but not very adept with windows programming or COM. However, I have a quick command line program to write to make use of a seed2key dll.
The dlls prototype is..
API seed2key(char *seed, BYTE *key). I know this because I have the source code for it.
However, when trying to use the seed2key function in a C++ console app, the compiler thinks that the parameters should be of type LPSTR and LPBYTE respectively.
Unfortunately I have no idea what these are. I have a 16 byte array carrying the seed, that i need to pass to this function.
How do i create an LPSTR from that?
Does anyone have any idea what parameters it is actually after, and can provide me with a way to do so?
Many Thanks to anyone who can help.
Paul.
|
|
|
|
|
LPSTR = long pointer to string, ie char *
LPBYTE = long pointer to byte, ie BYTE * -> ie unsigned char *
Do you have the code snippet that's failing to build?
|
|
|
|
|
Thanks for that! I couldnt find that information anywhere on the web!
The code snippet is below. It is VERY rough as I am hacking around to get a solution.
int main()
{
BOOL procReturn = 0;
HINSTANCE dllHandle = NULL;
KWP_COMPUTEKEYFROMSEED pSeedAndKeyFunc = NULL;
dllHandle = LoadLibrary("seed_inv.dll");
if (!dllHandle)
{
cout<< "Failed to Load dll" << endl;
}
else
{
cout<< "DLL loaded OK" << endl;
}
if (dllHandle)
pSeedAndKeyFunc = (KWP_COMPUTEKEYFROMSEED) GetProcAddress(dllHandle, "seed2key");
if (!pSeedAndKeyFunc)
{
cout<< "ProcAddress Failed"<
|
|
|
|
|
This should work:
BYTE seed[16] = {0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf,0x00};
status = (*pSeedAndKeyFunc)((LPSTR)seed,key);
it's probably looking for the null terminator on the string.
|
|
|
|
|
Fantastic. That seems to work a treat.
However, on the inside of the dll, the first function is this..
API seed2key (char *param, BYTE *key)
{
BYTE seed[16];
DWORD i, retLen, seedLen;
BYTE *scanPtr;
i = 0;
scanPtr = strtok(param, " \t\n");
while (scanPtr && i < 16) {
seed[i] = atoi(scanPtr);
scanPtr = strtok(NULL, " \t\n");
i++;
}
seedLen = i;
seedToKey (seed, seedLen, key, &retLen);
return (retLen);
}
the while loop iterates once through correctly, but on the second time the string tokenizer returns 0x0000000 into scanPtr.
When you hover over it in VS, the tooltip says. [scanPtr = 0x00000000 <bad ptr="">].
The above section of code seems to suggest that it is actually requiring a string with the delimeters " ", tab and newline.
Rather confusing - although seemingly a different issue, any ideas?
Thanks for the previous posts!
Paul.
|
|
|
|
|
I'd see if the seedToKey function their calling is exported, it seems like a safer function to use. Otherwise, I'd probably change this:
BYTE seed[16] = {0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf,0x00};
to
char seed[] = {0x1,'\n'...,'\n',0xf,0x00};
You can also eliminate the cast that way.
|
|
|
|
|
Hi All...
I have set up an environment in which a ASP page create a object of COM component deployed in COM+ environment. COM Componenet is launched in a dedicated process(DLLHost). In settings of COM+ application, I have set Enable Idle ShutDown Time to 3 minutes.
But DLLHost.exe does not terminates after 3 minutes. It terminates after around 20-25 minutes.
On windows 2000 DLLHost.exe does not terminates.
Can anyone explain me why this is so and what is the difference between windows2000 and windows server 2003 environment.
Suraj Gupta
|
|
|
|
|
In WinXP SP2, there is a service called "DCOM server process launcher" run via svchost.exe. Today I noticed in Process Explorer that there is a "iexplore.exe" process running as a child of this svchost.exe, and tracking back how I started this instance of Internet Explorer, I had clicked on "2 new email messages" in the MSN Messenger (6.2). This is very interesting and I dont know why internet explorer does not show up as a child process of MSN Messenger itself. Anyone any ideas?
I was curious, I then attached windbg to this svchost.exe and put a breakpoint on NtCreateProcessEx, and you know what, the breakpoint is hit even if I start IE from the Windows Explorer shortcuts. Infact, the breakpoint is hit for every process that I start from windows explorer. The difference, however, is that the process is still created as a child of explorer.exe and not as a child of svchost.exe when I start from Windows explorer.
The questions I have are:
1. How exactly does this DCOM server process launcher work? Are there any architecture overview documentation?
2. How do you communicate with it to start a new process? Which COM interface to use?
3. What decides on who is going to launch the new process? svchost or calling process?
I'm not sure if this is good forum to ask this question, if it is not and you know an alternate forum, please let me know.
thanks!
--s
|
|
|
|
|
Further, on WinXP SP1, this is what I notice when I click on "1 new email message" in MSN Messenger:
1. When I have an instance of IE already running, the new IE window is created off this process.
2. If there are no instances of IE running, a new "iexplore.exe" starts under "svchost.exe -k rpcss" service.
Anyone knows what is happening here?
thanks!
|
|
|
|
|
Not sure if this should be here or in the C# forum but here goes. I want to create an out-of-process COM component (like an ActiveX exe in VB6) in C# - does anybody know how to do this? I've created in-process COM component with no problems. Any ideas/links would be most appreciated.
Cheers
|
|
|
|
|
Hello london_ste,
I've been researching into this a few months back. Basically, you would need to create a .NET factory class (contained inside a DLL Assembly) that exposes methods that internally instantiate .NET classes from .NET Exe Assemblies. Let's call this the "factory" assembly.
This factory assembly will be wrapped up in a COM-callable wrapper via tlbimp.exe and Regasm.exe. It is your gateway to the creation of .NET classes housed inside .NET Exe Assemblies.
.NET Activation/Refletion or Remoting are techniques that can be used to create an instance of a .NET class housed inside a .NET EXE assembly.
The special thing about Remoting is that is can be used to instantiate a class from a running EXE application whereas Activation/Refletion loads an Assembly (DLL or Exe) and instantiates a class from the loaded Assembly module.
An example of a creation method can be fashioned as follows :
public object CreateInstance_ByActivation(string strAssemblyName, string strTypeName);
An unmanaged client (written in C++, say) can call this method as follows :
VARIANT varRet;
...
...
...
IFactory -> CreateInstance_ByActivation
(
bstrAssemblyName,
bstrTypeName,
&varRet
);
the object will be returned via the VARIANT "varRet". "varRet" will contain either an IUnknown pointer or an IDispatch pointer.
I'm planning to write an article on this in the future, watch out for it
Best Regards,
Bio.
|
|
|
|
|
Hi Lim,
Thanks for replying. But to be honest I'm not sure I understand. So what you are saying is wrap the exe in a DLL? and access that? But how is that out-of process? Or do you mean the DLL can instantiate and call directly into the exe which will be runnig outof-process ad somehow hold onto the reference to itso we can call more methods on the external exe?
Do you have any good links on Remoting which may help me understand more... Or any sample code you have which will allow me to work out wahts going would be appreciated....
|
|
|
|
|
Hello london_ste,
>> Or do you mean the DLL can instantiate and call directly into the exe which will be runnig outof-process ad somehow hold onto the reference to itso we can call more methods on the external exe?
Yes, this is what I mean. This DLL is what I refer to as the "Factory" DLL. It is also a .NET Assembly (a class library). Hence we will be working with at least 2 .NET Assemblies : the "factory" assembly and the .NET Exe Assembly which supplies the class that we want to expose to an unmanaged client.
This is how it works : an unmanaged client first talks to the "factory" assembly DLL through COM interface methods that are wrapped in a COM-Callable Wrapper. Let's call this interface the "factory" interface. Internally, the "factory" interface method performs the actual instantiation of the .NET class from the .NET Exe.
An example of such a "factory" method is :
public object CreateInstance_ByActivation(string strAssemblyName, string strTypeName);
The "factory" interface method can do the instantiation via Activation/Reflection or Remoting. After instantiating the .NET class instance (in the .NET Exe), the "factory" interface method delivers the .NET object directly to the unmanaged client by its return value (of type "object", which is translated into an "out" VARIANT parameter by COM interop).
An unmanaged client (written in C++, say) can call this method as follows :
VARIANT varRet;
...
...
...
IFactory -> CreateInstance_ByActivation
(
bstrAssemblyName,
bstrTypeName,
&varRet
);
The .NET object (housed in the .NET Exe Assembly) will be returned via the VARIANT "varRet". "varRet" will contain either an IUnknown pointer or an IDispatch pointer depending on how the class in the .NET Exe is attributed. You would retrieve the interface pointer by using the usual variant macros and functions, e.g. :
if ((V_VT(&varRet) != VT_EMPTY) && (V_UNKNOWN(&varRet) != NULL))
{
*ppTargetObjectUnknown = V_UNKNOWN(&varRet);
(*ppTargetObjectUnknown) -> AddRef();
}
Note that after the .NET Exe Class object has been delivered to the client this way, the "factory" is no longer needed. The client interacts with the object directly. This can be in the form of IDispatch::Invoke() or, if the client has the interface signature of the object, in the form of direct interface method calls (but QueryInterface() must be called on the returned IUnknown pointer first).
With several more developers recently asking for essentially the same information, I think I may want to write my article on this as soon as possible.
Concerning Remoting, there are many good introductory articles in CodeProject. I do recommend one written by me last year :
Simple but potentially useful example of .NET Remoting
http://www.codeproject.com/csharp/ProcessActivator.asp[^]
and
A Simple But Useful Example of .NET Remoting Part 2
http://www.codeproject.com/csharp/ProcessActivator2.asp[^]
Contact me again if you need further clarification.
Best Regards,
Bio.
-- modified at 4:13 Friday 9th December, 2005
|
|
|
|
|