|
Geeze, long enough post? It's best just to post only your trouble spot.
math415 wrote: If your program won't at least compile and run (even if it gives incorrect answers) you'll lose 10 points.
Homework problem. You should really be consulting with your instructor.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi ,
I want to write a sample application for registry cleaning.
I wanted to know how do we decide if a particular registry key is invaid or not so that we can delete the key.
How do we search for invalid registry keys.
I am using c++
Thanks,
Gayatri
|
|
|
|
|
The keys under HKEY_CLASSES_ROOT are pretty well defined - you can
cleanup orphaned file/type associations relatively easily.
Beyond that I'm not sure how much you can reliably do. There's no magic
APIs that will tell you if an item in the registry is still being used.
I do know you can make your system unusable very easily
Good luck!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for you answer.
It would be nice of you if you cold tell me how will is the relation mainitained for the keys which are being used .
I am novice to it,so it would be great if you could explain it with an example.
Thanks
|
|
|
|
|
|
Hi,
I want to find the active threads running in a process.
I am using c++ and win32 API's.
Thanks,
Gayatri
|
|
|
|
|
If this isn't a Managed C++ question (using .NET) please direct your question to C++ Forum[^]. If you are using the managed libraries, you can use the System.Diagnostics.Process[^] class to get the Threads[^] that belong to that process.
|
|
|
|
|
You could use the WMI Win32_Process and Win32_Thread classes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I need to call a managed C++ dll from our native C++ code. To manage this i followed the tutorial in http://support.microsoft.com/kb/828736 "How to call a managed DLL from native Visual C++ code in Visual Studio.NET or in Visual Studio 2005."
However I'm using VS2008 and the article is using a managed C# dll.
Were the article says:
Replace the following lines of code in the AssemblyInfo.cs file
[assembly: ComVisible(false)]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
with the following.
[assembly: ComVisible(true)]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("..\\..\\MyKeyFile.SNK")]
I added the SNK file to the projects property "linker->Advanced->Key File" and changed [assembly: ComVisible(false)] in the AssemblyInfo.cpp file.
Now when I build my solution I get following errors in the native code:
error C2787: 'WNXal::NeXus' : no GUID has been associated with this object
error C2079: 'pINeXus' uses undefined struct 'WNXal::INeXus'
Code snippit:
--------------
#import "../Lib/NeXus/References/WNXal.tlb" raw_interfaces_only
using namespace WNXal;
HRESULT hr = CoInitialize(NULL);
INeXus pINeXus(__uuidof(WNXal::NeXus));
long lResult = 0;
e = pINeXus->Initialize();
CoUninitialize();
Benny
|
|
|
|
|
Stray Bullet wrote: I need to call a managed C++ dll from our native C++ code.
Alternatively you can make a mixed mode project to solve that problem without the need to expose the managed classes using COM
[Native module] calls --> [Mixed Mode module] calls --> [Managed module]
no COM.
led mike
|
|
|
|
|
I have designed a Winform Form, lets say Form1.h. I can switch to its Form designer and drop components etc. Now, if i insert this Form1.h in a different solution/project, i can compile, call the Form, but i cannot switch to the form designer. It's like a plain .h file. How can i make VS2008 understand that this is a form, so that i can edit it visually?
I'm using VS2008 C++/CLR.
Thanks
|
|
|
|
|
uus831 wrote: Now, if i insert this Form1.h in a different solution/project, i can compile, call the Form, but i cannot switch to the form designer.
What if you copy and add the Form1.resx file to the new project as well?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, i tried that too, but its just the same. I cant switch to form designer.
|
|
|
|
|
I ran into a similar problem not long ago (using VS2005 Pro). Here's how I solved it
1. In the project you want a copy of the Form1, simply add a new Form object. Be sure to call it Form1 was well (or whatever you called it in your original project).
2. Delete the .h and .cpp files for the form you just created. Leave the .resx file alone.
3. Copy Form1.h and Form1.cpp from your original project to your new project and compile. Be sure to rename them to whatever you called the form you just deleted. Since your copied form is now the same name, it should work just fine.
I'm not certain if this is exactly what I did, but I have it documented at work. I can check on it Monday.
Dybs
|
|
|
|
|
Thanks!!! It works! I have tried, and it works great. Except, that you need to rename the namespace so that it is the same in the new project.
Great tip!
Thanks again.
|
|
|
|
|
Oh yeah, kinda forgot the namespace thing No problem, glad to help.
Dybs
|
|
|
|
|
Hi,
I'm trying to call CreateThread() from windows.h using the below code:
The problem argument seems to be the emphasised one...
<br />
unsigned long i;<br />
<br />
CreateThread(NULL, 0, LiftThread, (void *)i, 0, &id);<br />
Im getting the error:
Error 5 error C2440: 'function' : cannot convert from 'unsigned long (__cdecl *)(void *)' to 'LPTHREAD_START_ROUTINE'
Does anyone know how I could fix this?
Cheers,
|
|
|
|
|
Your thread procedure needs to be defined as follows:
DWORD WINAPI LiftThread(LPVOID lpParameter);
Is that how you defined it?
Also, non-C++/CLI questions should be posted on the Visual C++/MFC board
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Ok i'll give that a try.
Mark Salsbery wrote: DWORD WINAPI LiftThread(LPVOID lpParameter);
Tracing back the define statements I believe the function is defined like that, except there is no DWORD. I'll try it with the DWORD when I get home.
Mark Salsbery wrote> Also, non-C++/CLI questions should be posted on the Visual C++/MFC board
Whoops, prolly should have searched MFC and CLI before posting :P.
Thanks,
|
|
|
|
|
I am using Visual c++ NET 2005
In each forms I write down the path of Icon property.
When I load the program, the Icon appear on the left corner of Title bar but in left side of menu bar appears the default icon. I do no where to change this . I need that appears in menu bar a new icon instead of the default.
I need your help.
|
|
|
|
|
This isn't really a C++/CLI question.
Although you may get a solution here, you may want to try asking
this on the Windows Forms[^] board.
I'm not even sure what icon you're referring to
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
We are doing interop between MFC and a custom C# dialog control with multiple sub controls that we are hosting in a CDialog with the DDX_MangedControl.
Everything works as expected until the user enters a TextBox Field with UseSystemPasswordChar=true, with the caps lock key turned on.
At which time it displays a ballon message informing the user that the caps lock key is on.
When the user turns the caps lock key off the whole control surface with the exception of the TextBox field it self disappears.
If you let the ballon tip expire normally then the portion of the tip that was under the ballon tip does repaint.
Any suggestions on how to fix this?
Thanks!
|
|
|
|
|
What sort of things have you tried so far?
led mike
|
|
|
|
|
Well after a bit of seaching I found a example of code that supresses the tooltip popup with EM_SHOWBALLOONTIP which I then adapted as a bute force solution that works with a horible blink of the entire control.
I did this by adding a timer to the base control and starting it from the text field to refresh the entire control.
tb_password.Tag = (object)timer1;<br />
<br />
<br />
public class PasswordControl : TextBox<br />
{<br />
private const int EM_HIDEBALLOONTIP = 0x1504;<br />
protected override void WndProc(ref Message m)<br />
{<br />
if (m.Msg == EM_HIDEBALLOONTIP)<br />
{<br />
System.Windows.Forms.Timer timer =<br />
(System.Windows.Forms.Timer) this.Tag;<br />
timer.Start();<br />
}<br />
base.WndProc(ref m);<br />
}<br />
}<br />
<br />
<br />
private void timer1_Tick(object sender, EventArgs e)<br />
{<br />
timer1.Stop();<br />
this.Refresh();<br />
}
Does anyone have a better solution?
Thanks
|
|
|
|
|
fredsparkle wrote: Does anyone have a better solution?
Well I was going to suggest something until I saw you voted down my post.
led mike
|
|
|
|