|
Yulianto AKA goodmast3r wrote:
I was born on July
ME too , July THE 11
Yulianto AKA goodmast3r wrote:
what`s the meaning of
ThatsAlok
Alok has two meaning Light or Man with Beautiful hair.
and thatsalok mean i think it's simple thatsalok
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Your mistake is that you convert a pointer (this) to a window into a handle.
You have to do like this:
<br />
::SendMessage(m_hWnd,WM_CLOSE,0,0);<br />
SkyWalker
|
|
|
|
|
I have nearly finished my little beginners project and need help in formatting the output my code is below. My question is after the code
/////////////////////////////////////////////////////////////////////////////
// CReverseView message handlers
void CReverseView::OnReverse()
{
// TODO: Add your command handler code here
CEdit &edit = GetEditCtrl();
CString strText;
CString msg = "\r\nThe answer is ";
CString data; // storage for the read in data'
CString line; // to concactenate msg & data
BYTE a;
edit.GetWindowText(strText);
while (!strText.IsEmpty())
{
sscanf(strText,"%c",&a); //read the char
data = (BYTE)a; // put it in data
strText=(const char*)strText1;+1
// move the pointer
line = msg+=data;
// add CR/LF "The message is" to the beginning
}
strText = line;
edit.SetWindowText(strText);
//This prints The answer is qwerty
GetDocument()->SetModifiedFlag(TRUE) ;
}
The above code prints
The answer is qwerty
I want it to print out like this:-
The answer is q
The answer is w
The answer is e
The answer is r
The answer is t
The answer is y
It seems my string objects over write each other. How do I fix this or re set the "object counter" back to zero so that it overwrites the existing data? I have tried many ways but can't work it out
Thank you
|
|
|
|
|
hugPW wrote:
strText=(const char*)strText1;+1
The above statement should not compile.
How about something small like:
edit.GetWindowText(strText);
for (int x = 0; x < strText.GetLength(); x++)
line += "The answer is " + strText[x] + "\r\n";
strText = line;
edit.SetWindowText(strText);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thank you!!,
yes there was a typo in the code (extra1)
I found by trial & error an even easier way
strText=(const char*)00; // reset the string pointer
It works for my project and the output is how I want it.
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.
I want it to display constant width characters. (like notepad)
Thank you again for your kind support
|
|
|
|
|
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.
|
|
|
|