|
Thanks for the link. actually VS .Net 2003 beta doesn`t find
#using <axmscommlib.dll>
#using <mscommlib.dll>
using namespace AxMSCommLib;
using namespace MSCommLib;
unless i drag the AxMSComm from "Microsoft Communications Control" from toolbox menu
when i drag it
this->axMSComm1->Handshaking = HandshakingConstants::NoHandshaking; // no handshake is used
It doesnt find NoHandshaking function
what is the reason that VS 2003 .Net compiler doesn`t find that functions.
thanks!!
|
|
|
|
|
Hi there,
I have a strange thing happening with calloc/malloc. Here is my code:
...
double *a = (double*)malloc(Na*sizeof(double));
double *b = (double*)malloc(Nb*sizeof(double));
double *c = (double*)malloc(Nc*sizeof(double));
...
The problem is that the two pointers b and c point toward the same address. Anyone aware of this problem and how to fix it?? (I'm working under .NET2003)
Thanks a lot.
|
|
|
|
|
|
Yes, sorry for disturbance. Would that be in the Visual C++/MFC forum?
|
|
|
|
|
|
Hello...
I have a function called:
MyFunction(LPCVOID lpBuffer)
{
}
But my parameter is a String*, for example:
String* s = "Hello World";
Are there any possibilities to cast String* to LPCVOID ?
|
|
|
|
|
|
See System::Runtime::InteropServices::Marshal class.
|
|
|
|
|
You can't do a plain cast from a managed pointer to an unmanged one, you need to pin the managed pointer so the underlying object doesn't move during GCs.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hi, I would like to know how to search through a file for specific words or phrases using VisualC++ 2003
-- modified at 7:38 Thursday 20th July, 2006
|
|
|
|
|
Load the file into memory and search then. It's easier and faster.
|
|
|
|
|
I currently have a COM component (and source) that talks to a printer and also a hardware port through a Vendor supplied DLL that makes fairly low level calls, and was wondering if there is a reference for displaying how to create a Managed Assembly in C++ that can performed the unmanaged calls, but present a nice .Net interface for the other developers. It does lots of GetProcAddress and
I would prefer not to interop to my existing COM Component, because I am trying to get a clean project.
I could possibly do it in C#, but wondering if it would be better in managed C++?
<br />
PORTOUT PortOut;<br />
PORTWORDOUT PortWordOut;<br />
PORTDWORDOUT PortDWordOut;<br />
PORTIN PortIn;<br />
PORTWORDIN PortWordIn;<br />
PORTDWORDIN PortDWordIn;<br />
SETPORTBIT SetPortBit;<br />
CLRPORTBIT ClrPortBit;<br />
NOTPORTBIT NotPortBit;<br />
GETPORTBIT GetPortBit;<br />
RIGHTPORTSHIFT RightPortShift;<br />
LEFTPORTSHIFT LeftPortShift;<br />
ISDRIVERINSTALLED IsDriverInstalled;<br />
...<br />
and then makes calls like this<br />
...<br />
<br />
LoadIODLL();<br />
PortOut(0x2E,(unsigned char) 0x87);<br />
PortOut(0x2E,(unsigned char) 0x87);<br />
PortOut(0x2E,(unsigned char) 0x07);<br />
PortOut(0x2F,(unsigned char) 0x07);<br />
PortOut(0x2E,(unsigned char) 0xf1);<br />
<br />
...<br />
<br />
hio = LoadLibrary("cashdrawerio.dll");<br />
if (hio == NULL)<br />
{<br />
return;<br />
}<br />
else<br />
{<br />
<br />
PortOut = (PORTOUT)GetProcAddress(hio, "PortOut");<br />
PortWordOut = (PORTWORDOUT)GetProcAddress(hio, "PortWordOut");<br />
PortDWordOut = (PORTDWORDOUT)GetProcAddress(hio, "PortDWordOut");<br />
PortIn = (PORTIN)GetProcAddress(hio, "PortIn");<br />
PortWordIn = (PORTWORDIN)GetProcAddress(hio, "PortWordIn");<br />
PortDWordIn = (PORTDWORDIN)GetProcAddress(hio, "PortDWordIn");<br />
SetPortBit = (SETPORTBIT)GetProcAddress(hio, "SetPortBit");<br />
ClrPortBit = (CLRPORTBIT)GetProcAddress(hio, "ClrPortBit");<br />
NotPortBit = (NOTPORTBIT)GetProcAddress(hio, "NotPortBit");<br />
GetPortBit = (GETPORTBIT)GetProcAddress(hio, "GetPortBit");<br />
RightPortShift = (RIGHTPORTSHIFT)GetProcAddress(hio, "RightPortShift");<br />
LeftPortShift = (LEFTPORTSHIFT)GetProcAddress(hio, "LeftPortShift");<br />
IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled");<br />
<br />
}<br />
|
|
|
|
|
Hi there..
I'm currently writing a managed c++ application which adds user entered data (textbox) into a access database.
I have some problems with formatting the sql string in the right format.. this is the sql string:
String *sqlstr = S"INSERT INTO klanten (Naam, Adres) VALUES", textBox1->Text->ToString(), textBox2->Text->ToString();
When running the program I get the following error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
I don't know how to correct the sql string
|
|
|
|
|
vincent7_6 wrote: I don't know how to correct the sql string
Debug the application and get the sql string value. Then find out why it is not valid SQL. If you don't know SQL well enough to determine the problem, CodeProject has a SQL forum you get help from.
Also using SQL in this fashion makes the application vulnerable to "SQL Injection Attack".
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
SQL Syntax is:
INSERT INTO klanten (Naam, Adres) VALUES ('Whatever','Whatever')
But like led mike said, you should guard against:SQL Injection Attacks[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Using the designer to create the main form for an application generated the following code in the .cpp file:
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;
Application::Run(new DataForm(lpCmdLine));
return 0;
}
The DataForm class has a button which generates a new form:
linkedForm = new LinkedForm() ;
The LinkedForm class exists in the same namespace as the DataForm class.
What needs to be done to allow this child form to see public methods in it's parent, since a DataForm ptr cannot be declared globally? Are there any examples of parent/child form communications of this nature?
Thanks,
MrHonus
|
|
|
|
|
See the MVC (Model-View-Controller) design pattern. It is on Wikipedia. Forms are Views and should not be coupled. Views (Forms) should access a "Controller" to initiate action based on UI (User) events. Views subscribe to events exposed from the "Model" to be notified of data and/or "state" changes. Views then obtain the latest data to display from the "Model".
|
|
|
|
|
Well, since I used the .net designer to create all of the views, it doesn't seem to lend itself to mvc. Are there any examples of how to use mvc with studio/net generated forms?
Thanks for the reply
|
|
|
|
|
mrhonus wrote: it doesn't seem to lend itself to mvc.
That makes no sense.
mrhonus wrote: Are there any examples of how to use mvc with studio/net generated forms?
Sure the Microsoft UI Composit Application Block[^]
|
|
|
|
|
I agree, it makes no sense.
Well, I am looking for C++ examples.
Thanks
|
|
|
|
|
mrhonus wrote: Well, I am looking for C++ examples.
You are using .NET WinForms
mrhonus wrote: Application::Run(new DataForm(lpCmdLine));
The application block is .NET library so you can use it. If you can't translate C# samples into Managed C++ why are you doing Managed Development in C++?
|
|
|
|
|
Mainly because so many things which I know about C++ don't seem to apply in the .Net environment. I'm doing Managed Devlopment in C++ because I wasn't allowed to choose the development environment. I would have chosen Java, which is much more straightforward. But since you're now getting snide, I guess you've helped me enough--thanks for your time.
|
|
|
|
|
mrhonus wrote: But since you're now getting snide
Not at all. So many times in message based communications people leave out reasons for things that create gaps in understanding. I was just trying to understand how you arrived in your situation to see if a different view might help. It does not appear so.
mrhonus wrote: I would have chosen Java, which is much more straightforward.
Much more straight forward than Managed C++ but very similar to C#. Perhaps you could use C# Research apps as a way of learning the .NET libraries you need and then translate your own C# code into managed C++. That would also allow you to apply samples you can find to the C# research application. It's not real pretty but after time you probably won't need the C# step as you would be able to translate the samples directly to C++.
Also on the MSDN2 web site many of the .NET Framework Documentation contains short samples in C++.
|
|
|
|
|
Hi,
I've got a rather strange question that I've been trying to figure out. Perhaps some of you can give me some hints.
I'd like to call a java method from C++ (or any other language for that matter). The java method is compiled into a java bean which is contained in an applet. I've got no control over the applet and I have full control over the bean which contains a callback method to the applet. This is the method i'd like to call, is it possible?
Cheers!
|
|
|
|
|
Hi,
Check out JNI (Java Native Interface) for this.
|
|
|
|