|
|
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern uint MessageBox(IntPtr hWnd, String text, String caption, uint type);
|
|
|
|
|
Thank You somanova.
This command is working good
|
|
|
|
|
Hi.
I’ve searched for articles of how to implement my new .NET dll in my old MFC application. Firs of all – Is It possible. If I am really glad for tips on how to do it.
All tips are welcomed!
_____________________________
...and justice for all
APe
|
|
|
|
|
Hi all,
I have created setup program and C# program for conditionally creating shortcut in Desktop and Quick Launch. I could run many forms from that shorcut icon. I want to run a new application file from that icon. How is it possible? I have added that exe file in setup file's folder, but it is not run from that icon. How can i refer that exe? Pls help me to solve this.
Lisa
|
|
|
|
|
Check whether the shortcut points to the exact path of Your exe. Right click the shortcut - find target.
|
|
|
|
|
Thanks for your response Mr. Sathish.
Yes, i cheked the property of that shortcut. It shows the the C# program's exe's path.
1. I created Setup file for my application's exe.
2. I created C# application file for creating conditional shortcut for that setup file.
3. Now the shortcut is appeared in the desktop(if i select create destop in setup wizard during installation). But it doesnt run my application.
4. For running my application we need to know the path given by the user during installation. Because exe of the application and exe of the solution is stored in that path itself.
5. If i find that path by any C# method, i can run my application's exe.
Lisa
|
|
|
|
|
You could get the App installation path using these
Application.StartupPath or
Application.ExecutablePath
|
|
|
|
|
Hi all,
Is there any way to hide the Caption bar in a form?
I have seen a few applications who have removed the caption bar and or exchanged it with another bar, and was wondering on it can be done if at all?
cheers,
Mark
|
|
|
|
|
Set the property FormBorderStyle to none. This should remove the caption bar. Then you can create one on your own.
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
I have this problem I have been stuck on for ages!Can anyone help me out please??
I have a treeview. The nodes of this treeview are paths to a file that is to be showed in a webbrowser. When I click the link/node an html page is showen in the browser. Within this html-document there are internal links that are identified by the # sign. When the link is clicked the path will look like this:
file:///C:/Documents%20and%20Settings/froy/My%20Documents/Visual%20Studio%202005/Projects/TabHelp/TabHelp/bin/Debug/Teknisk.htm#lagring
You can see on the last part that "lagring" is a headline further down in the document Teknisk.htm. This means that when the root node is clicked the main document will be displayed (Teknisk.htm) and when the childnode is clicked it will jump down to the headline "lagring" using internal linking.
How is it possible to interpret the path including the # sign?
I get the path using the GetFullPath()- method, but when I include the # transform it to %23 (the hex) which is not interpretable by the browser.
Is there any possibility to get the full path including the last fragment and pass it to the browser?
Pleeeaasee help me.. this has tormented me for so long.
Thanks in advantage
Freya
|
|
|
|
|
The URL will work perfectly fine with the # sign. If for some reason the # is changed to %23, can't you change back %23 to the hash sign?
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
No.. unfortunately it doesn't.. it just stays as the %23 even if I hardcode the # using hex, ascii and whatever.. I have no more ideas left
Freya
|
|
|
|
|
I'm trying to create an instance of an object in a DLL dynamically and invoke a method on it, but an exception is thrown at the call a = Assembly.Load(absolutePath);
Assembly a = null;
string relativePath = @"..\..\MathHelper.dll";
string absolutePath = Path.GetFullPath(relativePath);
try
{
a = Assembly.Load(absolutePath);
Type mathHelperType = a.GetType("Vikram.MathHelper");
object mathHelper = Activator.CreateInstance(mathHelperType);
The exception message is
Could not load file or assembly 'c:\\vikram\\dotnet\\TypeReflection\\TypeReflect
ion\\MathHelper.dll' or one of its dependencies. The given assembly name or code
base was invalid. (Exception from HRESULT: 0x80131047)
The file is indeed there, and it is compiled under .NET 2.0, as is my code. From my VS command prompt, when I run ildasm c:\\vikram\\dotnet\\TypeReflection\\TypeReflection\\MathHelper.dll , it opens the DLL perfectly fine. What am I doing wrong?
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
Vikram A Punathambekar wrote: Assembly.Load(absolutePath);
Common mistake, dumb method naming. Use Assembly.LoadFile()
|
|
|
|
|
Thanks, leppie.
I feel like a dork - Only 10 minutes before I typed that code, I used the LoadFile() method. I either forgot, or it was a case of oversight - neither of which is good.
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
Same thing happened to me a week ago
|
|
|
|
|
Hi,
I want to display icon for menu items and i am using window application.
I look forward to the reply
-- modified at 3:36 Tuesday 21st February, 2006
|
|
|
|
|
Hi
I am trying to create a ActiveX object from a C# web service. When I create the object I get a "Permission denined" exception.
If I create the same object not from a web service, it works OK.
Here is the code:
V8O_PLU.CPluClass o ; // COM object
o = new V8O_PLU.CPluClass(); // exception occurs
Late biding causes same problem:
Type ObjectType = Type.GetTypeFromProgID("V8O_PLU.CPlu");
object po = Activator.CreateInstance(ObjectType);
Can anyone please advise why is this happening?
as I said, the same code works OK from a non-web-service code (e.g. WinForm).
Thank you.
|
|
|
|
|
The problem was that aspnet_wp.exe runs under the user ASPNET . The ASPNET user is defined as part of the Users group.
For some reason, on my development PC the ActiveX DLL's do not have permision for the Users to access. . Once I added the Users to the security list of my ActiveX's it works OK.
On my QA systems these DLL's do allow the Users group to run them. Strange.
|
|
|
|
|
Hey Howzit?
As you can see in the code below I am generating a Bitmap and saving it to disk, later in my program I display this .tiff file as the backgroundimage of a Panel. My question to you is, how can I generate multiple Bitmaps IN MEMORY (instead of saving to disk) and then display them later when I need to?
Thanks
using (Bitmap bitmap = new Bitmap((int)(scale * page.Width), (int)(scale * page.Height)))
{
Graphics graphics = Graphics.FromImage(bitmap);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.ScaleTransform(scale, scale);
graphics.Clear(Color.White);
page.Draw(graphics);
bitmap.Save("C:\\" + Convert.ToString(_currentDPI) + "dpi.tiff", ImageFormat.Tiff);
}
|
|
|
|
|
Use class local variables. Create an array of bitmaps (or an arraylist). Create the bitmaps.
class BitmapGenerator {
private ArrayList bitmaps = new ArrayList();
public YourFunction() {
...yourcode..
bitmaps.Add(bitmap);
}
}
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
Hey, thanks works, but now how to assign one of the bitmaps in the array to the background image of my panel?
|
|
|
|
|
Hi,
I am a newbie to C# and Im trying to redirect standard input, output and error of a console program written in C (MS VC 6.0) to a textbox on a form. The code for the redirecting looks like this:
private System.IO.StreamWriter c_StreamInput = null;
private System.IO.StreamReader c_StreamOutput = null;
private Thread c_ThreadRead = null;
private Process c_Process = null;
private void ReadStdOutputThreadProc()
{
try
{
string str = c_StreamOutput.ReadLine();
while(str != null)
{
txtboxCNF.AppendText(str+"\r\n");
Thread.Sleep(100);
str = c_StreamOutput.ReadLine();
}
}
catch(Exception) {}
}
private void btnStart_Click(object sender, System.EventArgs e)
{
if(c_Process == null)
{
c_Process = new Process();
ProcessStartInfo psi = new ProcessStartInfo("console.exe");
psi.UseShellExecute = false;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = true;
c_Process.StartInfo = psi;
c_Process.Start();
c_StreamInput = c_Process.StandardInput;
c_StreamOutput = c_Process.StandardOutput;
c_StreamInput.AutoFlush = true;
c_ThreadRead = new Thread(new ThreadStart(ReadStdOutputThreadProc));
c_ThreadRead.Start();
}
}
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (c_ThreadRead != null)
{
c_ThreadRead.Abort();
c_ThreadRead.Join();
}
if(c_Process != null && !c_Process.HasExited)
c_Process.Kill();
}
The console application that I am trying to run (console.exe) is a simple C program that prints a line text and then calls the getchar() function. The code is basically this:
#include "stdafx.h"
#include <conio.h>
int main(int argc, char* argv[])
{
printf ("Hello World !!\n");
int ch = getchar();
printf("Character = %s\n", ch);
return 0;
}
I have tried to run the C program without the getchar() function and it works. The problem arises when I use the getchar() function. I have tried getch() and gets() version without any success. I am not sure if I have to do anything special for showing output when using such functions.
Any help/pointers in this direction will be greately appreciated.
Thanks in advance.
Dribble
|
|
|
|
|
I think getchar requires EOL char (aka Enter or ^D i think).
|
|
|
|