|
Hi all,
i have created a unmanaged VC++ dll and then created a wrapper class for it . i have included this wrapper class in my c# by using add reference .The function takes ushort* as the input .i.e. i am should pass a string as an input to the function
Function Prototype is this:
void WCConvertImg(unsigned short __nogc * ,unsigned short __nogc *);
now that I am facing problem in passing parameter to this function. I tried first by using unsafe in C# and then with marshal class., I cannot assign the address of string variable to ushort * variable in C#, Its not allowed in managed code .
Regards
Gobu sk
|
|
|
|
|
CppClass::Foo(System::String *s)
{
const Char __pin* name = PtrToStringChars(s);
SomeSystemFunctionW(name) //W=WIDE (UnicodeVersion)
}
That way you'll get nice interface in c# .
|
|
|
|
|
when i try using the method i get this error
(30): error C2664: 'UnManagedImgConvert::ConvertImg' : cannot convert parameter 1 from 'const __wchar_t __pin *volatile __pin *volatile ' to 'WCHAR * '
ie i cant pass name pointer as a parameter to the to the unmanaged code
|
|
|
|
|
Thanks lesnikowski,
there is an alternative in c# we can use fixed(char * a=string variable).
i got it working.
Regards
gobu sk
|
|
|
|
|
Hi folks,
can somebody tell me why TextBoxes do not render the text (assigned through the Text property) properly when using new line escape sequence like in string s = "firstline\nsecondline"; . How can I solve this?
Thanks a lot in advance!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
try using "firstline\r\nsecondline";.
|
|
|
|
|
Correct!
Thanks!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
I would suggest to use
System.Environment.NewLine
to get the right newline for the system.
Greets
Roland
|
|
|
|
|
Hi,
I've created a MDI Form and placed a button control on it.
On clicking the button, a child form will be shown.
But the button control in the parent form is shown above the child form.
Is there any way to prevent this?
Thanks.
Vipin.
|
|
|
|
|
That's not exactly the best place for child controls. The Child forms actually reside inside a control on the MDI parent, called MDIClient. You can TRY to use the .SendToBack() method of the controls in question or you could try .BringToFront() on the MDIClient control. In order to get a reference to that control, though, you'll have to enumerate the Controls collection of the MDI parent form and search for a control of type MDIClient, for it has no Name.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
Is there any way to get the exe name : "iexplore.exe" using the System.Diagnostics.Process or any other class?
Pls help me with sample cpodes, if any.
Problem is that, the code,
"processObj.MainModule.FileName" returns "explorer.exe" which is not the correct one, I think.
Cheers,
ganesh.
|
|
|
|
|
It's true that explorer.exe is not MS Internet Explorer (it's Windows Explorer). However, if IE is running at the time the processes are enumerated, iexplore.exe should also appear in the list. I used the following code to list the processes on my workstation, and it worked like a charm:
using System;<br />
using System.Diagnostics;<br />
<br />
class ProcEnumerator<br />
{<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
<br />
Process[] localProcess = System.Diagnostics.Process.GetProcesses();<br />
foreach(Process p in localProcess)<br />
{<br />
try<br />
{<br />
Console.WriteLine(p.MainModule.FileName);<br />
}<br />
catch(Exception excp)<br />
{<br />
Console.WriteLine("*** '{0}': {1} - may be a placeholder.", p.ProcessName, excp.Message);<br />
}<br />
}<br />
<br />
Console.ReadLine();<br />
}<br />
}
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Actually, "Internet Explorer" is the WebBrowser control, a culmination of MSHTML, urlmon, and several other components. The WebBrowser control can be used in any ActiveX container, which both iexplore.exe and explorer.exe are. If you, for example, started iexplore.exe and then browsed to a folder (like C:\), it functions like Windows Explorer. The reverse is true because Windows Explorer is an ActiveX container that can host the WebBrowser control (just like you can in a .NET application, VB6 application, and many other client application frameworks).
So, when the MainModule.FileName returns explorer.exe, it is correct (and it couldn't be wrong anyway - the OS has to know what's loaded into the process space otherwise nothing works).
DeskBand developers (like the Search bar, Media bar, etc.) like myself use this fact to make sure the band isn't initialized if the containing process is explorer.exe, for example (so that it is only loaded into what most people call "Internet Explorer").
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Agreed.
I interpreted the question as asking how to determine if iexplore.exe was executing. If the question is "How do I tell if any 'IE' components are currently hosted?" in a process started by explorer.exe, for instance, it would be a more difficult task to determine how much "IE"-ness the explorer.exe process displayed (searching the associated modules blah blah blah).
Thanks for the clarification.
Jared
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Use property ModuleName
Process[] ProcessList = Process.GetProcesses();
ArrayList ProcessNames =new ArrayList ();
foreach(Process myProcess in ProcessList)
{
String myString = myProcess.ProcessName ;
string myModuleName;
try
{
myModuleName= myProcess.MainModule.ModuleName;
}
catch
{
myModuleName = "no name available";
}
Console.WriteLine(myModuleName);
}
DavidR
|
|
|
|
|
Hi people,
Can you tell me is there any real difference between:
IMyObject obj = (IMyObject) otherObject; and
IMyObject obj = otherObject as IMyObject;
Thanks
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Serge Lobko-Lobanovsky wrote:
IMyObject obj = (IMyObject) otherObject;
Will throw an exception on conversion failure.
Serge Lobko-Lobanovsky wrote:
IMyObject obj = otherObject as IMyObject;
Will assign null on conversion failure.
Take a look at the documentation for as[^].
www.troschuetz.de
|
|
|
|
|
|
Hi,
I have a WinForms program with an IE browser object (AxBrowser) hosted within my program which I cast the loaded document as IHTMLDocument2 to use the MSHTML editing features.
Problem is that I cannot stop the IE object from asking (before navigating to another doc) if I want to save the document if it has changed. Does anyone know which interface within MSHTML i can use to intercept this dialog and suppress it.
Thanks in advance
Richard
|
|
|
|
|
in My C/S WinForm program, Client contacts with Server using Socket.and Both of them written in C#.
i want to modify the C/S mode to B/S mode because i dont want to install a WinForm program at client. i would like to implement the same function at client using Browser.
i need drawing graphic/winform controls and many others.
do there have good solution in this case ?
And aslo i dont want to install CLR at client.
|
|
|
|
|
C/S ?? B/S ??
By this do you mean Client/Server and Browser/Server? If so, you do know that a browser is just a type of client.
If you don't want to install the CLR on the client then you cannot draw graphics and WinForm controls on the client.
If you want to convert your client code to be usable in a browser you are going to have to re-write the client as an ASP.NET application and host it on a server. The major architectural difference between ASP.NET applications and WinForms applications is that ASP.NET is stateless which means that your presentation layer cannot be ported easily and you will need to think about re-designing how it interacts with the user.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Hi,
I'm using the function drawString, and if i'm using the font "Microsoft Sans Serif" with fontStyle.Bold, it crashes and I get the exception " A generic error occurd in GDI+ ".
The code:
I'm calling the DrawString function from the printDocument.
private void PrintFormComponents(System.Drawing.Printing.PrintPageEventArgs ev)
{
ev.Graphics.DrawString(lineText, printFont, textBrush,point , new StringFormat));
}
the printFont is "Microsoft Sans Serif" ,10,fontStyle.Bold
Thanks,
yonit
|
|
|
|
|
What StringFormat are you actually using? Your sample code above uses new StringFormat with no parens, so that can't be it (perhaps you just forgot them and didn't copy and paste or anything). You might try using a typographic format, like the static StringFormat.GenericTypographic property, instead of just new'ing up a StringFormat .
A quick search on Google yields no known bugs using "Microsoft Sans Serif" and Graphics.DrawString .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi there!
A question for all folks that are using WeifenLuos DockManager (which I have to shortly intend is great!):
I've got two panes in my application. One is docked at the left and one has the state DockState.Document . I've got a couple of different DockContent derived Forms in this DocumentPanel. Depending on the users selection, I hide or show some of them using the appropriate functions Hide() and Show() of the DockContent deriatives.
Problem I'm having is that the documentPane (and it's Content windows) start flickering crazily. I've tried to ResumeLayout() and SuspendLayout() do supress layouting but it won't help. Goal is to supress any repainting until I'm set. Any ideas?
Thanks in advance!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
The best place for this question is on the discussion board under Weifen Luo's article, here[^]. He keeps it up to date and is the best person to ask about issues like this. It's also possible that it's a known bug and he just doesn't have a fix for it yet.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|