|
Try with this code:
CFile file;
if(file.Open(".",CFile::modeRead))
{
MessageBox(file.GetFilePath());
}
Ivan Cachicatari Blog[^]
www.latindevelopers.com
|
|
|
|
|
c+- wrote:
How to get current directory path in mfc??
This Code Will help
CString szCurrentDirectory;
{
CString csPath;
::GetModuleFileName(NULL,csPath.GetBuffer(MAX_PATH),MAX_PATH);
csPath.ReleaseBuffer();
szCurrentDirectory=csPath.Left(csPath.ReverseFind('\\'));
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Hi,
I'm using the
Express OLE DB Library[^], I have problem when try to build an application in Visual C++ .NET 2003:
SypODLCommand.h(27): error C3203: 'CRowset' : class template invalid as template argument for template parameter 'TRowset', expected a real type
SypODLCommand.h(27): error C3203: 'CRowset' : class template invalid as template argument for template parameter 'TRowset', expected a real type
SypODLRecordBase.h(53): error C3200: 'int' : invalid template argument for template parameter 'TRowset', expected a class template
SypODLRecordBase.h(53): error C3200: 'int' : invalid template argument for template parameter 'TRowset', expected a class template
SypODLRecordBase.h(53): error C3200: 'int' : invalid template argument for template parameter 'TRowset', expected a class template
SypODLRecordBase.h(53): error C3200: 'int' : invalid template argument for template parameter 'TRowset', expected a class template
SypODLRecordset.h(25): error C3203: 'CRowset' : class template invalid as template argument for template parameter 'TRowset', expected a real type
SypODLRecordset.h(25): error C3203: 'CRowset' : class template invalid as template argument for template parameter 'TRowset', expected a real type
How to fix this errors?
Ivan Cachicatari Blog[^]
www.latindevelopers.com
|
|
|
|
|
need more information...
are either CRowset or TRowset your classes ?
are you using either of those classes anywhere?
can we see the code where you're using them ?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
The declaration is:
template <typename TAccessor, typename TRowset=CRowset><br />
class CSypODLRecordBase : public CSypODLError<br />
{<br />
...<br />
<br />
CAccessorRowset<TAccessor, TRowset> *m_pSet;<br />
...<br />
};<br />
<br />
<br />
<br />
class CSypODLCommand : public CSypODLRecordBase<CDynamicParameterAccessorEx><br />
{<br />
....<br />
};<br />
My code;
<br />
CSypODLConnection *tmpConn = NULL;<br />
try<br />
{<br />
USES_CONVERSION;<br />
tmpConn = new CSypODLConnection();<br />
tmpConn->OpenFromInitializationString(T2OLE(path));<br />
m_Conn = tmpConn;<br />
}<br />
catch(CSypODLException& e)<br />
{<br />
if(tmpConn != NULL)<br />
{<br />
if(tmpConn->IsOpen()) <br />
tmpConn->Close();<br />
delete tmpConn;<br />
}<br />
e.DisplayError();<br />
return false;<br />
}<br />
|
|
|
|
|
Hello all,
I have dialog based application and I have UDP connection running on bacground ( this takes about 1% from 100Mb network capacity ). Each time when I receive an UDP packet so then the communication class send a message to the main window. And when I drag the main window for the top blue strip (with min and max buttons) so then I lost messages from communication class ...
Why?
Do you have any solution suggestion?
Thank you for any advice and direction to I could go ....
KaMinek
|
|
|
|
|
Are you saying that when you move the window by dragging the title bar it no longer receives messages? Does it happen only while you move it or do you keep not getting the messages after you stop moving it?
Are you sure the messages are lost or maybe just queued behind the window movement messages?
Are you sure the (I assume) custom messages you sent to the window are of the proper WM_USER+X range and do not happen to have the same IDs are system messages?
|
|
|
|
|
The messages are not WM_USER but they are RegisterWindowMessage(s).
Yes, when I drag window by the title bar there hapanned something and my registered message dont swim up in the main window WindowProc handler. This is happaned even if I only press left mouse button on the title bar.
Why? Why? Why?
|
|
|
|
|
Hello
I have installed farsi font on an english version of Windows. I can press Alt+Shift to switch between farsi and english.
I have written a program that has farsi text used with TextOut function and also the window caption is in farsi language and also some buttons and some static texts.
this program runs correctly on my computer, but when I move it to another computer whitch farsi language has been installed on it, the texts are not shown correctly.
I hate using Unicode. how can I notify Windows that my program uses Codepage 1256 and Windows uses this codepage to show texts? (charset: Arabic(Windows))
|
|
|
|
|
hi, I just started to look at windbg, but having problem with the memory dump file....
I should be able to open the file inside the visual studio and attach with my application, but wasn't able to do so, seems like if i open the project the dump file goes away....
thanks.
|
|
|
|
|
WINDBG actually goes away if you open Visual Studio? Not exactly sure what you're doing, but you should be able to open windbg on a memory dump and infact you can even view source from windbg using the symbols. However opening VS should not conflict with WINDBG. Alternatively you can use a different editor to view your source.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
SetupDiClassGuidsFromName(nameof_class,&class_GuidList,
4,&required_size);
How can i find out if the class_GuidList is a device setup class or an interface class, bcos i need a device setup class to use the function
SetupDiGetClassRegistryProperty()
|
|
|
|
|
How to communicate with a micro controller using USB port?
|
|
|
|
|
Using an USB port is not as easy as accessing a serial port. The device connected to your USB port needs to enumerates (it will send his vendor ID and Product ID) in order for the OS to load the appropiate driver. The OS looks through inf files to match the ID's with a specific driver. Once the driver has been loaded, you can then, in your program, retrieve a handle to the driver with the function CreateFile and then send and retrieve information using the DeviceIOControl function.
Now my question is: what kind of micro-controller are you using and what do you need to do exactly ?
Normally, the driver is shipped with the USB device so you should find all the documentation with it.
|
|
|
|
|
Hello Mr. Cedric Moonen,
Thanks a lot for help. I am using Mitsubishi micro controller M16C/62P. If there is any ready communication code is available on any of the sites, I need not reinvent the wheel. Can you advise any?
Thanks and best regards,
Paresh
|
|
|
|
|
Ok, but it's a USB micro-controller ? So, what drivers are supplied with the micro-controller ? What's specified in their documentation ?
Can you give the link to the product so I can have a look (I search on google but there was too much different results).
|
|
|
|
|
Hello Mr. Cedrric Moonen,
http://www.renesas.com/fmwk.jsp?cnt=usb_family_landing.jsp&fp=/products/mpumcu/usb_device/
This is the link. In the search option at the top, enter "M16C/62P" and click on Go button. It will display a table. Search for "M30624FGPFP" in the last column. In that row, click on the "PDF". You will be presented with the data sheet, hardware manual and software manual for the product.
They have FOUSB as a tool to do the flash programming. But I donot want to use that tool. I want to implement the data transfer using C/C++. First stage for this is to write the driver or use the existing communication driver available. then next stage is to send the frames via USB. Can you tell me where can i get the ready made communication driver or source code for that?
Thanks in advance and best regards,
Paresh
|
|
|
|
|
We used the USBHIDAPI.DLL from www.kadtronix.com[^] and had very good luck with it. If you know what the bytes are coming from the device and can parse it yourself, then you're all set. We used it for a special joystick (HID device, not game device) to read analog X, Y, and Z values and the DLL was very responsive. We could also send info to it to calibrate it. It is compatible with VC++ and VB and comes with .lib and .dll libraries
|
|
|
|
|
Paresh emb wrote:
How to communicate with a micro controller using USB port?
How can I access USB port (COM 5)?[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
There's an easy way to communicate with usb devices. With build in usb device io you're not really able to write to usb devices easily.
Just install the libusb drivers which has a filesize of about 1/7 MB. There are alreay src samples delivered with this package. You just need to know what you would like to send to the device.
|
|
|
|
|
Can I know where is the website for this libusb driver?
I downloaded and install the files from
http://libusb-win32.sourceforge.net/#support
1) libusb-win32-filter-bin-0.1.10.1.exe
2) libusb-win32-src-0.1.10.1.tar.gz
3)libusb-win32-device-bin-0.1.10.1.tar.gz
I could not find any documentation to link it with
visual C ++ . Can anyone advise me? Or link me to one
documentation?
THere is error whenever i try to use the data
structure in libusb.
Thanks
cheers
Dingyao
|
|
|
|
|
Just a sample for libusb libusb-win32-filter-bin-0.1.8.0.exe
To enumerate all webcams connected to your usb port..... looks a bit messy here
1)
struct usb_bus *bus;
struct usb_device *dev;
usb_init();
usb_find_busses();
usb_find_devices();
for (bus = usb_get_busses(); bus; bus = bus >next)
{
for (dev = bus->devices; dev; dev = dev->next)
{
usb_dev_handle *udev;
if (!((dev->descriptor.idVendor==PRODUCT_VENDOR_ID) && (dev->descriptor.idProduct == PRODUCT_ID)))
continue;
udev = usb_open(dev);
if (udev)
{
..... Do something here
usb_close (udev);
}
}
// ---------------------------------------------
To send something to the usb device ....
buf[0] = pan & 0xff;
buf[1] = (pan>>8) & 0xff;
buf[2] = tilt & 0xff;
buf[3] = (tilt>>8) & 0xff;
usb_control_msg(udev, XX, XX, XX, XX, buf, X, XX);
..where XX is device specific
-- modified at 12:28 Wednesday 14th September, 2005
|
|
|
|
|
I'm puzzled by ON_WM_CREATE() macro's definition
{ WM_CREATE, 0, 0, 0, AfxSig_is, \
(AFX_PMSG)(AFX_PMSGW)(int (AFX_MSG_CALL CWnd::*)(LPCREATESTRUCT))&OnCreate }
I know that the text in bold is a pointer to CWnd's function, and I know the statement after the last period is the "routine to call", But I don't quite understand what the statement trying to accomplish, Is it just a cast for function OnCreate?
|
|
|
|
|
Hello,
First, why do you wan't to know how the message macro's work?
I created a thread class, that also has a message map and the following explanation comes from my experiance.
The message map of MFC is an array of structs. These structs have one general pointer to a message. (Casting back to the right form is done using signatures.)
The statement is casting a function pointer to a general pointer used by the the message map of MFC. This is done in multiple steps, since you cannot cast it directly. The compiler will complain heavily about casting function pointers. For this reason it is first casted to a base class member function pointer. Second it is casted to an intermediate type and finally it is casted to the general type.
I hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|