|
Hi,
1.
first of all, are you on the right forum? have you switched from native C/C++ coding to managed C++/CLI coding all of a sudden?
2.
please use PRE tags to show code snippets and do show the relevant code; nobody is going to download a ZIP/RAR file to help you out.
3.
if you want N spokes, your best bet is using a for loop. They are pretty good at executing the same code over and over with a slight twist; and add 90 degrees to the angle each time.
4.
Stop using all those magic constants (180, 3.1415926, 161, 52, 41). Either use a function parameter, use an object property (e.g. drawing size), use an official const such as Math.Pi, or if all else fails provide an actual const yourself. You will get more readable code with fewer errors.
|
|
|
|
|
Hi,
Each time I create a new windows forms application, the resource file that I get was app.rc. How to create and set a .resx as the resource file on my application?
Thanks
|
|
|
|
|
Hello,
I need to generate structs and classes at run time in C#(might be in CLI) managed environment. Suppose I have all data and all data types associated with those data memebers of some class/struct. Now I need to generate structs/classes at runtime and after that I need to map data inside those runtime created structs fields.
e.g I have read data from an XML file i.e BSTR field1,BSTR field2,BSTR field3,BSTR field4,BSTR field5,long field6.
Now I need to create struct at runtime which has sizeof the sum of all fields (which I listed above) and then I can easily access those fields one by one. So that whole complete struct is formed.
How can I solve this problem?
Regards Usman
|
|
|
|
|
glitteringsound wrote: e.g I have read data from an XML file i.e BSTR field1,BSTR field2,BSTR field3,BSTR field4,BSTR field5,long field6
I don't think creating types at runtime is the correct way to do this. You should try to design your types in such a way that it can hold the data coming from XML file.
For the example you have shown, I'd create a class which has a List which can hold all BSTR fields. If datatype of BSTR fields are not primitive, I'd create a separate type for BSTR and keep it in the above said list. Now if you have different data types for fields, you can keep a datatype identifier field which will tell you what type the value should be. This will help you to cast to the correct value before using.
Best wishes,
Navaneeth
|
|
|
|
|
hi guys... when i press enter the app just closes.. how do i make a newline on a edit text field?
what i am trying to do is print whatever is typed on the edit control and show it on the static. i did all that..
the problem is when i try to press the [Enter] on my keyboard, the app just closes, what i want to do is make a 'newline' just like in notepad when i press [Enter]..
i already set the Edit box to multiline, still NO-Go-AMIGO...
need help guys..thanks ahead..
modified on Sunday, August 1, 2010 11:41 PM
|
|
|
|
|
You also need the ES_WANTRETURN style on your control, see here[^] for full details of Edit control windows.
It's time for a new signature.
|
|
|
|
|
FWIW: I'm puzzled by your switch from C/C++/MFC forum to this forum, which is for managed C++, i.e. a C++ dialect that is part of the .NET Framework.
|
|
|
|
|
Hi I am trying to get the IPv6 address for the current adapter in my Vista equalant pc(WIN-PE environment).
Hear is the problem. First i started with WMI class "Win32_NetworkAdapterConfiguration" for setting IPv6 address,subnetlen, gateway and retrieving the IPv6 address,subnetlen, gateway. But I was not able to success in getting and setting those values for ipv6. I used the enable static function in this wmi class. But failed.
Now I this iphelper functions are looks interesting, these functions directly returning the IPv6 address that will solve my problem.
Kindly request all people hear, If any one tried sample code for setting and getting IPv6 address ("Looking only for C++/vc++/win32/same family") using wmi lease share that sample example if possible.
Else please share the example of using this iphelper functions.
Thanks a lot
Haranadh
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
I know the map file generation on VC6.0 as we need to go to Project Settings->C/C++->Set Debug Info to "Line Numbers Only"
then Go to Link-> Enable "Generate Map file" option and provide file name and add these switches "MAPINFO:LINES" and "MAPINFO:EXPORTS"
Now i`m using VS2008, i`m unable to Generate map file. Could you please help me on that.
Thank you
Live life happily until your last second
|
|
|
|
|
You can do that by /MAP[^] compiler switch.
Best wishes,
Navaneeth
|
|
|
|
|
could you tell me where do i need to add this switch
Live life happily until your last second
|
|
|
|
|
Open the properties window of your project, then the option you are interested in is located in the Debugging section, under Linker
|
|
|
|
|
ya..I`m getting MAP file but there is no line number information. How do i can enable that?
Live life happily until your last second
|
|
|
|
|
I'm afraid, but the compiler support for map files has been reduced; I think that the only chance you have to get the addresses for line-number is through the pdb files. To deal with them you can have a look to:
|
|
|
|
|
Hi,
How could I pass data from MFC application to .Net user control? I have added .Net Chart Control to MFC application. The problem is passing data to that control.
Does anyone have any ideas about this?
Regards
Daniel
|
|
|
|
|
|
Hi every one.
I'm tring to save IHTMLElement which has IMG tag to hard drive. I'm not tring to save the entire web page as image. NO. I'm tring to save single image (IHTMLElement of Tag IMG) to hard drive.
I tried IHTMLElementRender::DrawToDC(), but it works only if the IHTMLElement size is less than the physical size of my computer screen. If the IHTMLElement (the single image or picture) size is larger than my computer's screen, the function ( DrawToDC() ) draws partial image.
Any help????????
Thanks
|
|
|
|
|
Just getting back to C++ after a long hiatus in C#, and am designing a product that's going to need an ATL IE BHO. It occurs to me that if the managed/unmanaged modules were partitioned properly, there might be some significant advantages in being able to use the CLR. I chose to use C++ rather than C# for the BHO portion of the project because I understand that there are issues with potentially having more than one version of the runtime in-process with IE.
Anyone here ever considered/tried this strategy for an ATL COM object that interops with the CLR? If so, what kind of issues have you run into?
Thanks!
D. T. Doutel
|
|
|
|
|
Nevermind; until IE knows how to deal with the possibility of multiple versions of the CLR in-process, if indeed that's even possible, C++/CLI won't make any difference.
|
|
|
|
|
Hello Coders,
I have built a wrapper for native code. I need a struct to store information (FileData). The public class for information is inside the same namespace than the consumer class. But when I compile the project, the compiler says me that there is not any FileData class into SMComm namespace and other errors int relation with this one:
<code>error C2039: 'FileData' : is not a member of 'SMComm'
sm-comm\Wrapper.h(21) : error C2143: syntax error : missing ';' before '^'
sm-comm\Wrapper.h(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
sm-comm\Wrapper.h(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
sm-comm\Wrapper.h(22) : error C2039: 'FileData' : is not a member of 'SMComm'
sm-comm\Wrapper.h(22) : error C2143: syntax error : missing ';' before '^'
sm-comm\Wrapper.h(22) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
sm-comm\Wrapper.h(22) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int</code>
The code here:
<code>#pragma once
#include &quot;Comunicaciones.h&
using namespace System;
using namespace System::Runtime::InteropServices;
namespace SMComm {
public ref class CommWrapper
{
public:
// Ctor Dtor
CommWrapper();
~CommWrapper();
// Variables
public:
SMComm::FileData^ m_memIntern;
SMComm::FileData^ m_memExtern;
private:
public:
// Methods to wrap the native code
bool ConectaServidor(String^ direccion, int puerto, String^ usuario, String^ password);
bool EnviaTrama(int tipoTrama, short parametroExtra);
bool EnviaTrama(String^ tipoTrama, short parametroExtra);
// Access methods
bool EstaConectado();
protected:
// Navive class
CComunicaciones* m_pComm;
};
// Struct for file information
public value class FileData
{
int id;
String^ nombre;
};
}<</code>
Do you know what's wrong?
I'm new in C++/CLI (more or less), but I have programmed with C# and native C++.
Thank you for help me.
|
|
|
|
|
A newbie mistake .
I did not declare the "struct" FileData before the consumer class, so this one doesn't know about it.
Anyway, thanks you to be here.
|
|
|
|
|
Hi,
I've been working with the property grid for a while (I hate that thing) trying to create dynamic, nested objects in runtime; after a bit of work have got it to work. What I did was put ParameterGrids within ParameterGrids, this allowed my Prop Grid to have as many expandable objects within expandable objects as I want. And by using custom type converts I've been able to name them whatever I want. The only issue I'm still faced with that each one of these ParameterGrid Items in the grid has the button which allows the user to edit the collection (like you would see in the designer on, for instance, a tool bar items collection field). This button pops up a dialog which lets the user edit the collection, adding or removing objects. This I do NOT want. Is there a type converter, property macro any other way to disable or remove this collection editing button? Thanks for the help!
|
|
|
|
|
Hello,
I am trying to launch background processes using System.Diagnostic.Process API . It launches every process e.g notepad.exe, all native processes and all windows form base processes. But this unable to launch pure managed GUI less assemblies. Task Manager not showing those assemblies listed in its list as seperate process. Niether exception occure nor any error code returned.
Is there any other way to launch background processes on demand using Process.Start for pure managed assemblies properly visible even for task manager
Regards Usman
|
|
|
|
|
Hello,
I am facing an exception in C++/CLI while dynamically loading assembly which itself an EXE created in C++/CLI managed mode using Assembly.Load. It successfully loads a dll assembly, but fails to load EXE assembly and generates following exception:
An unhandled exception of type 'System.IO.FileLoadException' occurred in TestManager.dll
Could not load file or assembly 'testAssembly, Version=1.0.3836.39802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)
Note : TestManager.dll itself managed dll and loaded into another CLR process in CLI and trying to load EXE assembly as seperate process but fails and generates about exception.
Regards
Usman
|
|
|
|
|
Hi,
Please make sure that you have correct version of testAssembly specifed in the manifest for EXE fiel that try to load this assembly. Maybe instead of loading specific version you could specify version 1.0.* which will load latest version of assembly that has Release version 1.0.
Other option is just trigger full recompilation of entire project. This could help if compiler messed-up with version which it automatically assigned.
This error means that you try load incorrect version of assembly testAssemby. CLI will deny load version of assembly other then 1.0.3836.39802 in you case. If your testAssembly has version 1.0.3836.39802 then this error could indicated that one of dependencies that have assembly testAssembly could not be loadede. Navigate through chain of InnerException properties to diagnose which assembly exacly could not be loaded.
Hope this helps.
|
|
|
|