|
Dirk, Thanks for the response.
I seem to be a bit thick headed, I don't understand what you are suggesting. What data type is pStr? The compiler does not recognize GetBuffer as a member of LPTSTR or of .Net String class. It is a member of .Net MemoryStream class. How do you propose that I do this?
What I am doing now to convert a String* variable named line to a LPTSTR (char*) is:
char* chars = new char[line->length+1];
for (register i = 0; i < line->length; i++) {
chars[i] = (char)line->Chars[i];
}
//Add the NULL at the end
chars[line->length] = '\0';
The above seems to work but it just seems like a lot of processing to just convert from one data type to another. I'm thinking that there must be a more straightforward way.
Thanks
John B
|
|
|
|
|
hi john,
try the MS website...
(http://support.microsoft.com/?kbid=311259[^])
they provide 3 methods, method 3 being the easiest...
cheers
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
+++++++++++++++++++++++++++
Developing new generation Traffic Micro-simulation Tools for Traffic Engineers
em: nikolaos.vogiatzis@unisa.edu.au
|
|
|
|
|
Nik
Thanks for the tip
Actually, the only method that worked for me was method 2.
Method 3 would not compile. The include altstr.h produced IServiceProvider error.
Method 1 compiled OK, but I had to use a LPSTR cast to get it to compile. However, it produced a number (34") regardless of the value of the String* that I fed it.
Perhaps there are ways to get methods 1 & 3 to work, but I don't know enough about .Net to figure out how.
Cheers and best wishes in your PhD effort.
John
|
|
|
|
|
Is there a method in C++ .NET to emulate a real time loop while still using the managed forms editor?
while(true)
{
if(PeekMessage(msg, hWnd, 0, 0, PM_REMOVE)
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
fGameLoop();
}
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
Hi,
how can i add the XP style to my managed visual c++ app?
Cheers
Skute
|
|
|
|
|
|
as you know xp..manages nearly everything.......anyways..mate..if you wonna get that style to fit...you just have to reverse a script overlock.....if you know what i mean....i've programmed my scripty managing coder..to get the files ....into attaching with different headers...and *.*...
so just type the folling in your script rerloader
#########
rect=##/crak
f;sectr
########
BVT.SL
OCK=3278.43.(YOU PUT THE REST)
this will reverse the mess that was made while generating the whole app........this will generate.......it
dj_oden
|
|
|
|
|
dj_oden wrote:
as you know xp..manages nearly everything.......anyways..mate..if you wonna get that style to fit...you just have to reverse a script overlock.....if you know what i mean....i've programmed my scripty managing coder..to get the files ....into attaching with different headers...and *.*...
so just type the folling in your script rerloader
#########
rect=##/crak
f;sectr
########
BVT.SL
OCK=3278.43.(YOU PUT THE REST)
this will reverse the mess that was made while generating the whole app........this will generate.......it
err what the heck are you talking about??
Skute
|
|
|
|
|
Problem is in getting the selected item in a ListView. The view property is Details and MultiSelect is set to false. listView Here is the code I use:
Void Form1::lvMain_SelectedIndexChanged(System::Object * sender, System::EventArgs * e)
{
ListView::SelectedListViewItemCollection* lvc = lvMain->get_SelectedItems();
IEnumerator* ie = lvc->GetEnumerator();
ie->MoveNext();
ListViewItem* lvi = __try_cast<ListViewItem*>(ie->Current);
.
.
.
}
The first time a selection is made in the listbox by clicking on an item, the selected item is returned in the SelectedListViewItemCollection which has a count of 1. without a problem. HOWEVER, the next time an item is clicked, the SelectedListViewItemCollection that is returned has a count of 0. Naturally, attempting to move the iterator causes an exception to be thrown.
Does anyone know why nothing is returned in the SelectedListViewItemCollection when the selection is changed the second time??? Also, what is the solution???
Appreciate any help.
John B
|
|
|
|
|
Here is what seems to be happening: The first time an item is selected, the SelectedIndexChanged event is called and a SelectedListViewItemCollection is returned containing the selected item. Subsequent item selections seem to cause the SelectedIndexChanged event to be fired TWICE, the first time returning an empty collection but the second time returning selected items.
Is this the way it is supposed to work???????
John B
|
|
|
|
|
Try
listView1->FocusedItem->Text;
|
|
|
|
|
I am writing a program that interfaces with Flight Sim 2002 and 2004. I am writing this in .NET VC++ 7. I have one 100ms timer, and I am currently testing the program with only one funtion call. Every 100ms if a few variables are met the program accelerates the aircraft (writes a new velocity value to FS). That's the theory... in reality it only writes about once every 2-3 seconds or so. How can I make the program run faster, at a higher cpu priority, or whatever?
James Meade
vLT(jg) vUSN
vOPSOFF VAQ-140
|
|
|
|
|
i still didnt know the whole problem..cause you didnt give me a whole specification....you must atleast give me you pc characterisitcs..and by that i'll tell you if you can fix the whole thing up..or will make your pc blow into bytes..anyways.....
here's what you should do....try to install an xp...(if you have windows xp version)...try to install the xp speeder program...that'll make your file transfer between commands be much faster....if it did work...then your pc is fine for this kinda job..now ..after doing so...
type this into your sppeder
engag.sedrom
$@@@@@@@@@yikes.sys
&^$^$^^%%%
()tt( { }{}
whost secri
)))
() (((0
&^T.t.t
cerrebrom./..
dj_oden
|
|
|
|
|
Is there a way to print a .net bitmap with mfc? Thanks
|
|
|
|
|
Hi, im trying to load an icon into a NotifyIcon structure, however it wont work when i try to load from a resource:
m_pNotifyIcon->Icon = new System::Drawing::Icon(GetType(), "App.ico");
The only way i can get it to work is if i load it directly from disk (by doing Icon("App.ico")). But i would rather it load from the embedded icon in the resource. I have included the resource.h and the icons ID is IDI_APP.
Here is the code for the constructor:
<br />
frmSysTray::frmSysTray()<br />
{<br />
m_pContextMenu = new Windows::Forms::ContextMenu();<br />
m_pContextMenu->MenuItems->Add("Test1");<br />
m_pContextMenu->MenuItems->Add("Test2");<br />
<br />
m_pNotifyIcon = new NotifyIcon();<br />
m_pNotifyIcon->Icon = new Drawing::Icon(GetType(), "App.ico");<br />
m_pNotifyIcon->ContextMenu = m_pContextMenu;<br />
m_pNotifyIcon->Visible = true;<br />
}<br />
Cheers
Skute
|
|
|
|
|
hi all...
ok, ill get to the nuts and bolts of the problem...
i keep getting a C2259 error ('class' : cannot instantiate abstract class due to following members: )
now the class it is complaining about is one that instantiates IDataParameterCollection and ArrayList... specifically:
public __gc class NewSQLParameterCollection: public ArrayList, public IDataParameterCollection{};
and the function it is complaining about is this one...
bool Contains(String *p)<br />
{<br />
if (this->IndexOf(p) >= 0)<br />
return true;<br />
else<br />
return false;<br />
}
(umm, and before you say that i am missing the NewSQLParameterCollection:: indentifier, i should mention that i am inlining the call within the class header... )
now the problem occurs when in a subsequent class i call the following
function test::sometest()<br />
{<br />
NewSQLParameterCollection *p = new NewSQLParameterCollection(S"Name", Object);<br />
}
it says that it can't find the function (as in bool Contains(...) ) above, but as you can see, it's there...
any ideas?
this is for an open source C++.NET MySQL driver i am writing, so any help would be GREATLY appreciated...
cheers and thanks
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
+++++++++++++++++++++++++++
Developing new generation Traffic Micro-simulation Tools for Traffic Engineers
em: nikolaos.vogiatzis@unisa.edu.au
|
|
|
|
|
You probably need to uniquely identify your implementation.
bool IDataParameterCollection::Contains(String *p)
{
if (this->IndexOf(p) >= 0)
return true;
else
return false;
}
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
hi roger...
yeah, already tried that, and then it comes up with:
MySqlParameterCollection.h(23) : error C3244: 'IDataParameterCollection.Contains' : this method was introduced by 'System::Data::IDataParameterCollection' not by 'System::Data::IDataParameterCollection'<br />
which is strange... however, you did inspire me and i tried this:
bool MySqlParameterCollection::Contains(String *p)<br />
{<br />
if (this->IndexOf(p) >= 0)<br />
return true;<br />
else<br />
return false;<br />
}
and that seems to have removed one of the 'errors', i just need to workout why the same technique is not working for __property bool get_IsNullable(void) for MySqlParameter, and i will have it!
cheers and thanks for your assistance roger...
nik
Nik Vogiatzis
PhD Candidate: University of South Australia
+++++++++++++++++++++++++++
Developing new generation Traffic Micro-simulation Tools for Traffic Engineers
em: nikolaos.vogiatzis@unisa.edu.au
|
|
|
|
|
Hi,
If i made a new "TextBox" for example, based on the old Forms::TextBox, how could i package it up into a .dll so that i could link to it in other applications?
Also, is it best to put it into the System::Windows::Forms namespace? ie:
<br />
namespace System<br />
{<br />
namespace Windows<br />
{<br />
namespace Forms<br />
{<br />
class MyTextBox : public TextBox<br />
{<br />
...<br />
};<br />
};<br />
};<br />
};<br />
Skute
|
|
|
|
|
Im created a toolbar that allows one of the four buttons in the toolbar to be set at a time, by maintaining a enum constant in the CDocument derived class. Now the UPDATE_UI functions only execute on startup and not all of the time like there supposed to.
Im changing other variables in the doc class else where, is there something I should be setting when i alter these variables.
Please Help
Keith
|
|
|
|
|
Hi,
I'm developing a Activex with .net C++, i try to add a method that has both external and internal name into this activex, so that I can call this method ourside of this activex. but I can notfind a way to do this job as we do this with classwizard in VC.
So pls help me, if you know how to solve this problem?
thx.
Ray
|
|
|
|
|
:(Hello Friends,
We are making a VC++ . net designer control by wrapping an mfc control we are already having.But when I place the control in the toolbox, by selecting the control dll , there is some unhandled exception happens and the proces is terminated.This problem is not happening when I place the control by copying and pasting form some existing samples using this control ,made previously by another developer.That is once this control is copied and placed on some design form, there is no problem in adding this control to the tool box.
while debugging I could see the _DllMainCRTStartup() function is repeatedly called .Each time DllMainCRTStartup is called the application slows down and finally an unhandled exception is being thrown.
We are using the .NET Framework 1.0 version 1.0.3705
and IDE 2002 version 7.0.9466
Please help me...Thankz in advance
Sathyan
|
|
|
|
|
I was trying to add a custom contorl to the tool box , the IDE was crashed .I tried with a simple class that derived form control that too could not be added to the toolbox when placed within this assembly(same result the ide was crashed).
The call stack is like the following.
ntdll.dll!77f827e8()
kernel32.dll!77e86a3d()
user32.dll!77e2481d()
user32.dll!77e24600()
user32.dll!77e3a1ab()
ntdll.dll!77fa032f()
user32.dll!77e1569d()
msenv.dll!50080965()
msenv.dll!50080939()
the error message got was
Unhandled exception at 0x096cb860 in devenv.exe: 0xC0000005: Access violation reading location 0x096cb860.
is it due to some problem with the dll since it was made by wrapping an mfc control..
Friends plz tell me due to what reason the this is happening..
Sathyan
|
|
|
|
|
Even though the traffic seems to be relatively small here, I'll go ahead and ask anyway. I'm writing a managed dll in C++ (actually it's an NUnit test dll), and I need to be able to get the dll's HINSTANCE - to either load resources or to call GetModuleFileName( ). So far I've tried the following:
<br />
_pModule->get_m_hInstResource( )<br />
_pModule->get_m_hInst( )<br />
::GetModuleHandle( NULL )<br />
AfxGetResourceHandle( )<br />
AfxGetInstanceHandle( )<br />
But no luck. They just return NULL. Has anyone had any similar problem in the past, and if so, what did you do to solve it?
Daníel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Because its a managed DLL, I think the best approach would be to
get at the Resources via
using System::Reflection
__gc Assembly* Assembly;
__gc ???* [] mResults; //Don't recall the return type.
mResult[] = Assemble->GetExecutingAssembly()->GetLoadedModules(true);
And then walk the array of objects filtering for IsResource() property.
|
|
|
|