|
hugPW wrote:
strText=(const char*)00; // reset the string pointer
Wrong. strText is not a pointer, it is a CString object. Use the Empty() method instead.
hugPW wrote:
Now all I want to do is change the font as the text is uneven, I believe it is set true type, with different widths for different characters.
This is called proportional spacing as opposed to mono or fixed spacing.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks again !
How do I change from proportional to fixed spacing?
The program is basically a MFC single document interface created with the wizard
Regards
Peter
|
|
|
|
|
While I've not actually tried it, I think you can create a CFont member variable in the CView -derived class. In the view's OnCreate() method, create the desired font. Then call SetFont() with a pointer to the newly created font.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How do I change from proportional to fixed spacing?
Basically, the program is a MFC Single Document Interface
Regards
Peter
|
|
|
|
|
Hi,
I'm using CrateFile(),WriteFile(),ReadFile() functions when my application works with the serial ports(COM1,COM2,...).
Now I need to do this with the USB port.
How can I do this?
Any links,samples,tutorials will be helpful.
Best regards,
Eli
|
|
|
|
|
Are you using a RS-232 to USB adapter ? (a cable that enables you to use a serial device in the USB port). If yes, this is exactly the same because it is considered as a virtual COM port...
If no, this is much more complicated because you need a driver (that is normally shipped with the USB device), and there must be normally some doc supplied with it. You open the communication using the CreateFile function but you 'communicate' with the driver using special commands (that are specific to your USB device). These commands are sent using the DeviceIoControl function
Hope this helps
|
|
|
|
|
Hi,
First,thanks for your prompt reply.
I have RS232 to BlueTooth adapter that works fine through COM1 port.
Now i need to do the same,but with USB dongle(USB to BlueTooth).
When the communication is through the serial port,i'm using
CreateFile("COM1:",.......);
Do you know what should i send instead "COM1:" to open the USB port?
My problem is not communicate with the driver - my problem is to open the USB port.
Best regards,
Eli
|
|
|
|
|
Ok, so here forget about the second part of my message, that was just in case of a specific USB device (no virtual COM port).
For your case, first check which port number is created by your adapted (plug your cable and check this in the device manager: you will have the complete list of ports that are on the computer with their numbers). The second thing is that you don't need to provide the ":" this is just "COM1".
One last thing is that ports greater than 9 must be opened like this: "\\.\COM10" (don't forget to supply a double '\' if coded in a string...)
|
|
|
|
|
well i dunno if u can use the writeFile()...etc directly as u do for the serial port but u can send the data to the Usb either by using the built in drivers in windows for usb or u will have to make one urself.....
I have sent data to the usb windows driver (midi data).....but if u r building ur own driver.....thatz a lot of work
herez one link
try out this link......it tell u all u need to know abt how to send data thru usb using windows drivers and also ur own made usb driver.....
http://www.lvr.com/usb.htm[^]
gud info....
hope that helpz.....
cheerz.....
|
|
|
|
|
..morning...
How do I convert a char to an int int VC++?
doneirik
|
|
|
|
|
|
|
a char type IS an integer. it just is on 8 bits instead of 16 bits for short or 32 for long. int may be 16, 32 or 64 bits depending on the architecture.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
How SHCreateDirectory() can be used to create nested directories?
|
|
|
|
|
Here is Example.
let you want to Create a Directory "cp" in C:\
So call of funtion would be like this
CString <code>strDir</code>="c:\\cp";
if(<code>SHCreateDirectoryEx</code>(this->m_hWnd,strDir,NULL);
Now let you want to create a user Directory under cp
just after above code
strDir+="\\user";
if(<code>SHCreateDirectoryEx</code>(this->m_hWnd,strDir,NULL);
Now third and last Example,create a Monishanker directory in USER directory
strDir+="\\monishanker";
if(<code>SHCreateDirectoryEx</code>(this->m_hWnd,strDir,NULL);
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
From the docs:This function creates a file system folder whose fully qualified path is given by pszPath. If one or more of the intermediate folders do not exist, they will be created as well. So you don't have to do anything special.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I have a class member that is static because I want only one instance of it for all of the class' objects. However, I get linker errors (LNK2001) because the variable is used in other files. Is there a way I can have only one instance of a variable in a class but also not limit the scope of the variable?
Thank you,
Galen
|
|
|
|
|
did you #include d your class declaration file in the cpp file using your static member ?
did you also take care of the datas protection of your member (public , protected , private ) ?
if the member is use by another class, you might also say that the class is a friend one...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have included the class declaration file in my cpp file. The static member is public. I want to be able to access the static member from the main function so making a class a friend wouldn't help here. Are static class members supposed to be visible outside the file they are declared in?
|
|
|
|
|
A normal static variable is not visible outside of the source file in which is is declared.
A static member function for a C++ class does not have the hidden 'this' pointer parameter at beginning of function. If you need to access the class data from within the static member function, you must explicitly pass in the 'this' pointer yourself as one of the parameters to the function.
A static member variable for a class means that there is only one instance of the variable no matter how many instances of the class are created. You can typically access the 'static' member variable from another file by using the class name ahead of the variable, such as MyClass::m_StaticVariable , and you have to make sure you include the header file, so the class definition exists, in the source file that is accessing the static member variable.
|
|
|
|
|
Hi everyone,
Using: VC++ .NET
My project involves sending a message from one computer to another.
I am using CSocket as the connection between these two computers. On the computer that receives the message, I am using the CSocket.Receive method to receive the incoming message. I have made it working, but somehow, I discover that when I call the Receive method on the receiving computer, the program 'hangs' (i.e. the form cannot move) until it actually receives the message. Is there in anyway helps to prevent this (the program does not 'hang', while still trying to receive a message)?
My client code goes something like this:
CSocket client;
client.Create();
client.Connect(ip,port); // ip and port have been specified before
client.Receive(&msgLength, 4); // i believe the program 'hangs' here until it gets something.
BYTE* msgByte = new BYTE[msgLength];
Thank you and your answer is greatly appreciated.
|
|
|
|
|
Hi,
I seem to be having a problem including a new class in my project.I have a separate file called calc.cpp/h to include the CCalc class.
But when i do the necessary things and compile/build it,then it gives me some class type redifinition error of some three different classes.
How do I remove this class type redifinition error and what could be the possible causes.
As soon as i include this class in any other file in my proj,then it gives the error saying class type redifinition of three other classes.
thanks,
Arjun
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
it is common problem with c++ when you include same header file in two file and these two file including each other.
one possible solution is to declare you class header file this way.
#ifndef MY_HEADER_FILE
#define MY_HEADER_FILE
includes
...................
your class declartion
...................
#endif
this will gurantee inclusion of your class only one time.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok,
I have already done that,but I get that error anyway.This class type redifinition that i get is not for the new class(CCalc) that i included,but for some three other classes.
But,the error that I get is not for this class it is for some three other classes,and this error arises only when I use the include directive(#include<calc.h>).
c:\arjMuMS\NewEng\BackupNewMumsEngine\Vars.h(19): error C2011: 'CVars' : 'class' type redefinition
This is the error it gives me,I have a variable of CVars type declared and used in CCalc class.But i cannot figure out the problem.
thanks,
Arjun.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
maybe CVars is a class that already exist in the compiler's library...
you'd better define your class with a name you're certain that none already use it...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|