|
i can't load a Mesh into my directx App as it views as empty one
but when i see it in the mesh viewer utility it is there and i can see it
|
|
|
|
|
Sounds like you're not resolving the path to the file correctly. If your .X file is stored as a separate file, make sure you take the current working directory into account (may not be the application base), or use the application base by using Assembly.GetExecutingAssembly().Location . IIRC, the Mesh class can also accept a Stream , so if you embedded the .X file as an embedded resource, you can use Assembly.GetManifestResourceStream to get an instance of a Stream for the resource.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey
Is it posble to have controls like buttons, pictureboxes, and maby own made controls.
I have loot at the ListView.controls.add, but i dont get this to work and am not sure if this even have somthing to do with the windows form controls like buttons, pictureboxes etc.
Pleas help
//Jimmy
|
|
|
|
|
You can't add controls to the ListView like that - it's not a container. You can add controls but you need to owner draw everything, and I remember giving you links to a couple examples here on CodeProject. Use those and read about the List-View[^] common control for information on messages, notifications, styles, and such. .NET doesn't currently expose any simple way of doing this - you have to revert back to Win32 methods.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi.
i am developing a project in csharp.
and in this project i will mointor all
the files and application that will be
used by the user while he is logon on the
system.
Does any one have any idea or a link to
some project where i can find help about
this.
Thanks in Advance.
|
|
|
|
|
I think you can start with FileSystemWatcher control.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
You should look into Windows Hooks[^]. C# is really not the best language for this. C/C++ would be better suited for something that needs to be fast and may or may not load in-proc with other applications.
For more information on Windows Hooks, see Hooks[^] in the Platform SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
|
Hello Benzite!
If you enter into the article area, go into General C#, and enter the COM Interop list you will find a number of articles there. The two specific articles you want pertain to the IDocHostUIHandler hooks.
This is the link to my article:
http://www.codeproject.com/csharp/winformiehost.asp[^]
This is the link to Nicks article:
http://www.codeproject.com/csharp/advhost.asp[^]
Don't mind Heath. He helps alot but he has the bedside manner of a cold shower in the middle of winter.
Condor
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
|
Yep, and lets just let all the wannabe programmers breeze through life without doing their own work or looking things up. Congratulations for fostering the problem with this industry.
Besides, both articles you listed appeared at the top of the search results I linked anyway. I guess two clicks is one to many for you both? Oh, the pain...
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to develop an application that will not require the user having MS SQL or ORACLE or even Access (MS Office). Also I envisage that my data will accumulate to quite a large volume so I do not wish to use XML. What I am looking for is information on how develop and deploy a windows application with MSDE or JET. I would obviously deploy JET or MSDE with my application.
Any relevant refs?
Thanks
SFB
|
|
|
|
|
MSDE is engine of SQLServer which doesn't have user interface and some of those tools exist with SQLServer. Now whats your problem which you need refs about?
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Using .mdb files does not require Microsoft Access - it's merely a development environment for Jet databases. To distribute Jet databases, you must install the Jet runtime, which you can download from http://www.microsoft.com/data[^]. This is most often installed already on client machines. Note that Jet is not currently installed with MDAC (there were prior to 2.6). For information about downloading the Jet runtime, see KB article Q239114[^].
The MSDE - while providing a true RDBMS - can be more difficult to deploy. The MSDE - like SQL Server, of which many components are shared - can only be installed for 16 instances, including those instances that are SQL Server. In the MSDE downloads, there are 16 MSIs (Windows Installer Databases). Most applications will pick one and stick with it. Each one contains a different ProductCode that you can use for upgrades (such as SP3, which I think is part of the base MSDE install now). Some applications - such as ours - will even distribute all 16 MSIs and use a boostrap that will determine which one should be used (in case another product has already installed another instance using the MSI that we might've picked). This definitely adds to the complication. You could always use that existing instance and attack your databases, but then you have two or more products tied together with a single instance that might lead to additional problems (like if the other product upgrades the master table and breaks some of your functionality).
You can read more about MSDE deployment on the MSDE site at http://www.microsoft.com/sql/msde[^], as well as download it and its service packs. Note that VS.NET also includes the MSDE set (a single instance named VSdotNET).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
When I try to compile my application it always displays the error message, "Static Member '(control)' cannot be referenced with an instant reference; qualify it with a type name instead." I access most of my controls that are on this form from other forms, so at the beginning of the class when all of the controls are declared as private automatically, I changed them to public static.
I Changed This:
private System.Windows.Forms.PictureBox pboBoard;
private System.Windows.Forms.MainMenu mnu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.Label lbl4;
private System.Windows.Forms.PictureBox pboP1;
private System.Windows.Forms.PictureBox pboP2;
private System.Windows.Forms.Button cmd1;
private System.Windows.Forms.Label lbl1;
private System.Windows.Forms.Label lbl2;
To This:
public static System.Windows.Forms.PictureBox pboBoard;
public static System.Windows.Forms.MainMenu mnu1;
public static System.Windows.Forms.MenuItem menuItem1;
public static System.Windows.Forms.MenuItem menuItem2;
public static System.Windows.Forms.MenuItem menuItem3;
public static System.Windows.Forms.MenuItem menuItem4;
public static System.Windows.Forms.MenuItem menuItem5;
public static System.Windows.Forms.MenuItem menuItem6;
public static System.Windows.Forms.MenuItem menuItem7;
public static System.Windows.Forms.Label lbl4;
public static System.Windows.Forms.PictureBox pboP1;
public static System.Windows.Forms.PictureBox pboP2;
public static System.Windows.Forms.Button cmd1;
public static System.Windows.Forms.Label lbl1;
public static System.Windows.Forms.Label lbl2;
Now, there is no problem with the outside access of these controls, but when the components are initialized, it doesn't recognize the reference, "this". The only thing I could think of was changing, "this" to, "Form1"
I Changed This:
public void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.pboBoard = new System.Windows.Forms.PictureBox();
this.mnu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.lbl4 = new System.Windows.Forms.Label();
this.pboP1 = new System.Windows.Forms.PictureBox();
this.pboP2 = new System.Windows.Forms.PictureBox();
this.cmd1 = new System.Windows.Forms.Button();
this.lbl1 = new System.Windows.Forms.Label();
this.lbl2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// pboBoard
//
this.pboBoard.Image = ((System.Drawing.Bitmap)(resources.GetObject("pboBoard.Image")));
this.pboBoard.Location = new System.Drawing.Point(-8, -8);
this.pboBoard.Name = "pboBoard";
this.pboBoard.Size = new System.Drawing.Size(584, 544);
this.pboBoard.TabIndex = 0;
this.pboBoard.TabStop = false;
//
// mnu1
//
this.mnu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem4,
this.menuItem5,
this.menuItem6,
this.menuItem7});
this.menuItem1.Text = "&File";
//
// menuItem4
//
this.menuItem4.Index = 0;
this.menuItem4.Text = "&New Game";
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.Text = "&Start Level";
//
// menuItem6
//
this.menuItem6.Index = 2;
this.menuItem6.Text = "-";
//
// menuItem7
//
this.menuItem7.Index = 3;
this.menuItem7.Text = "E&xit";
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem3});
this.menuItem2.Text = "&Help";
//
// menuItem3
//
this.menuItem3.Index = 0;
this.menuItem3.Text = "&About...";
//
// lbl4
//
this.lbl4.BackColor = System.Drawing.Color.Black;
this.lbl4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lbl4.Font = new System.Drawing.Font("Desdemona", 20.25F);
this.lbl4.ForeColor = System.Drawing.Color.White;
this.lbl4.Location = new System.Drawing.Point(8, 64);
this.lbl4.Name = "lbl4";
this.lbl4.Size = new System.Drawing.Size(528, 40);
this.lbl4.TabIndex = 1;
this.lbl4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pboP1
//
this.pboP1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pboP1.Image")));
this.pboP1.Location = new System.Drawing.Point(16, 168);
this.pboP1.Name = "pboP1";
this.pboP1.Size = new System.Drawing.Size(35, 50);
this.pboP1.TabIndex = 2;
this.pboP1.TabStop = false;
//
// pboP2
//
this.pboP2.Image = ((System.Drawing.Bitmap)(resources.GetObject("pboP2.Image")));
this.pboP2.Location = new System.Drawing.Point(496, 416);
this.pboP2.Name = "pboP2";
this.pboP2.Size = new System.Drawing.Size(35, 50);
this.pboP2.TabIndex = 3;
this.pboP2.TabStop = false;
//
// cmd1
//
this.cmd1.Enabled = false;
this.cmd1.Font = new System.Drawing.Font("Desdemona", 36F, System.Drawing.FontStyle.Bold);
this.cmd1.Location = new System.Drawing.Point(0, 256);
this.cmd1.Name = "cmd1";
this.cmd1.Size = new System.Drawing.Size(152, 104);
this.cmd1.TabIndex = 4;
this.cmd1.Text = "Start";
//
// lbl1
//
this.lbl1.AutoSize = true;
this.lbl1.Font = new System.Drawing.Font("Desdemona", 26.25F);
this.lbl1.Location = new System.Drawing.Point(160, 160);
this.lbl1.Name = "lbl1";
this.lbl1.Size = new System.Drawing.Size(0, 41);
this.lbl1.TabIndex = 5;
//
// lbl2
//
this.lbl2.AutoSize = true;
this.lbl2.Font = new System.Drawing.Font("Desdemona", 26.25F);
this.lbl2.Location = new System.Drawing.Point(72, 432);
this.lbl2.Name = "lbl2";
this.lbl2.Size = new System.Drawing.Size(0, 41);
this.lbl2.TabIndex = 6;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(544, 529);
this.ControlBox = false;
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.lbl2,
this.lbl1,
this.cmd1,
this.pboP2,
this.pboP1,
this.lbl4,
this.pboBoard});
this.ForeColor = System.Drawing.Color.White;
this.Menu = this.mnu1;
this.Name = "Form1";
this.Text = "Elicit Response";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
To This:
public void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
Form1.pboBoard = new System.Windows.Forms.PictureBox();
Form1.mnu1 = new System.Windows.Forms.MainMenu();
Form1.menuItem1 = new System.Windows.Forms.MenuItem();
Form1.menuItem4 = new System.Windows.Forms.MenuItem();
Form1.menuItem5 = new System.Windows.Forms.MenuItem();
Form1.menuItem6 = new System.Windows.Forms.MenuItem();
Form1.menuItem7 = new System.Windows.Forms.MenuItem();
Form1.menuItem2 = new System.Windows.Forms.MenuItem();
Form1.menuItem3 = new System.Windows.Forms.MenuItem();
Form1.lbl4 = new System.Windows.Forms.Label();
Form1.pboP1 = new System.Windows.Forms.PictureBox();
Form1.pboP2 = new System.Windows.Forms.PictureBox();
Form1.cmd1 = new System.Windows.Forms.Button();
Form1.lbl1 = new System.Windows.Forms.Label();
Form1.lbl2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// pboBoard
//
Form1.pboBoard.Image = ((System.Drawing.Bitmap)(resources.GetObject("pboBoard.Image")));
Form1.pboBoard.Location = new System.Drawing.Point(-8, -8);
Form1.pboBoard.Name = "pboBoard";
Form1.pboBoard.Size = new System.Drawing.Size(584, 544);
Form1.pboBoard.TabIndex = 0;
Form1.pboBoard.TabStop = false;
//
// mnu1
//
Form1.mnu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
Form1.menuItem1,
Form1.menuItem2});
//
// menuItem1
//
Form1.menuItem1.Index = 0;
Form1.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
Form1.menuItem4,
Form1.menuItem5,
Form1.menuItem6,
Form1.menuItem7});
Form1.menuItem1.Text = "&File";
//
// menuItem4
//
Form1.menuItem4.Index = 0;
Form1.menuItem4.Text = "&New Game";
//
// menuItem5
//
Form1.menuItem5.Index = 1;
Form1.menuItem5.Text = "&Start Level";
//
// menuItem6
//
Form1.menuItem6.Index = 2;
Form1.menuItem6.Text = "-";
//
// menuItem7
//
Form1.menuItem7.Index = 3;
Form1.menuItem7.Text = "E&xit";
//
// menuItem2
//
Form1.menuItem2.Index = 1;
Form1.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
Form1.menuItem3});
Form1.menuItem2.Text = "&Help";
//
// menuItem3
//
Form1.menuItem3.Index = 0;
Form1.menuItem3.Text = "&About...";
//
// lbl4
//
Form1.lbl4.BackColor = System.Drawing.Color.Black;
Form1.lbl4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
Form1.lbl4.Font = new System.Drawing.Font("Desdemona", 20.25F);
Form1.lbl4.ForeColor = System.Drawing.Color.White;
Form1.lbl4.Location = new System.Drawing.Point(8, 64);
Form1.lbl4.Name = "lbl4";
Form1.lbl4.Size = new System.Drawing.Size(528, 40);
Form1.lbl4.TabIndex = 1;
Form1.lbl4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pboP1
//
Form1.pboP1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pboP1.Image")));
Form1.pboP1.Location = new System.Drawing.Point(16, 168);
Form1.pboP1.Name = "pboP1";
Form1.pboP1.Size = new System.Drawing.Size(35, 50);
Form1.pboP1.TabIndex = 2;
Form1.pboP1.TabStop = false;
//
// pboP2
//
Form1.pboP2.Image = ((System.Drawing.Bitmap)(resources.GetObject("pboP2.Image")));
Form1.pboP2.Location = new System.Drawing.Point(496, 416);
Form1.pboP2.Name = "pboP2";
Form1.pboP2.Size = new System.Drawing.Size(35, 50);
Form1.pboP2.TabIndex = 3;
Form1.pboP2.TabStop = false;
//
// cmd1
//
Form1.cmd1.Enabled = false;
Form1.cmd1.Font = new System.Drawing.Font("Desdemona", 36F, System.Drawing.FontStyle.Bold);
Form1.cmd1.Location = new System.Drawing.Point(0, 256);
Form1.cmd1.Name = "cmd1";
Form1.cmd1.Size = new System.Drawing.Size(152, 104);
Form1.cmd1.TabIndex = 4;
Form1.cmd1.Text = "Start";
//
// lbl1
//
Form1.lbl1.AutoSize = true;
Form1.lbl1.Font = new System.Drawing.Font("Desdemona", 26.25F);
Form1.lbl1.Location = new System.Drawing.Point(160, 160);
Form1.lbl1.Name = "lbl1";
Form1.lbl1.Size = new System.Drawing.Size(0, 41);
Form1.lbl1.TabIndex = 5;
//
// lbl2
//
Form1.lbl2.AutoSize = true;
Form1.lbl2.Font = new System.Drawing.Font("Desdemona", 26.25F);
Form1.lbl2.Location = new System.Drawing.Point(72, 432);
Form1.lbl2.Name = "lbl2";
Form1.lbl2.Size = new System.Drawing.Size(0, 41);
Form1.lbl2.TabIndex = 6;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(544, 529);
this.ControlBox = false;
this.Controls.AddRange(new System.Windows.Forms.Control[] {
Form1.lbl2,
Form1.lbl1,
Form1.cmd1,
Form1.pboP2,
Form1.pboP1,
Form1.lbl4,
Form1.pboBoard});
this.ForeColor = System.Drawing.Color.White;
this.Menu = Form1.mnu1;
this.Name = "Form1";
this.Text = "Elicit Response";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
This created some problems as well; all of the error messages would dissappear, but when I would go under the Form1[Design] tab, all of the controls would dissappear. I would compile the program without any problems; the controls would display, but nothing would work, it would be like there would be no code at all. I have no idea what is wrong, could someone help me out?
|
|
|
|
|
How about providing a code sample next time
Were you maybe trying something like this
<br />
MyForm form1 = new MyForm();<br />
form1.StaticCtrl<br />
If so then try
<br />
MyForm.StaticCtrl<br />
|
|
|
|
|
Besides what Mark said, you don't want your controls static. You actually attempted to fix the original problem in exactly the opposite way that the compiler error implied. You shouldn't make your instance members static, but make your instance qualifier for your static method a Type like Mark said.
Trying to add static controls to a form won't work. With some careful handling, you might be able to get it to work for one form, but additional instances of the form will throw exceptions or even kill your app because window handles (which back the controls in Windows Forms) cannot be shared by parent windows.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I create a mfc dll and there is an export function DoOCR(LPCTSTR infile,LPCTSTR outfile , LPCTSTR libpath).
infile and outfile is the path of input file and output file .
Now , I wanna use this dll in C# web service.
I am a beginner of c# and web service .how should i do ?
thank you!
|
|
|
|
|
Languages targeting the CLR (i.e., ".NET Languages" like C#) can P/Invoke native functions (so this isn't web service-specific, to note).
For more information on P/Invoking native functions, see Consuming Unmanaged DLL Functions[^] in the .NET Framework SDK.
Your declaration would look something like this (but read the section above to understand what all this means):
[DllImport("yourmfc.dll", CharSet=CharSet.Auto)]
private static extern void DoOCR(string infile, string outfile, string libpath);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have done it , but there is some problems.
I think it's the problem about privilege to read file and I have solve it by another method.
To my surprise , I can read some files and can't read the others . There is no difference between these files .
Can you tell me why it's so ? Thanks a lot.
|
|
|
|
|
There's many things that could cause this. For one, ASP.NET runs as a particular user - ASPNET by default (a local account). Read more about the <processModel> section in the .NET Framework SDK. If this user doesn't have privileges to access the files in that directory (or an ACL is applied to the file itself), then they can't access it. ASP.NET does not run with administrative privileges and it'd be EXTREMELY stupid to do so, as it opens many possible exploits.
It could also be code access security, a feature of the CLR that grants permissions to an application based on evidence. There is more information on this in the .NET Framework SDK as well.
In either or none of these cases, the exception message - even a Win32 result code - should tell you what the problem is. If you don't see an exception in your page, look at the /trace.axd file (the log viewer in the root of your web application) if tracing is enabled.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thank you very much . I will try it right away.
|
|
|
|
|
I have done it , but there is some problems.
I think it's the problem about privilege to read file and I have solve it by another method.
To my surprise , I can read some files and can't read the others . There is no difference between these files .
Can you tell me why it's so ? Thanks a lot.
|
|
|
|
|