|
If I remmeber, the return value of SendMessage() is the number of characters copied to the string. Also before getting the text, you are supposed to set the first character in the buffer to the size of the buffer, so comparing to NULL is not going to work, you should check if it changed at all.
|
|
|
|
|
I'm not sure i'm following you, but you made me think to compare the length of the string to not 0 and it's working perfectly.
BTW to be sure we were talking of the same thing an editbox is a field you enter text in it and you access the text with ControlName->Text.
|
|
|
|
|
You MFCer's!! In plain win 32 we send a message to the edit box EM_GETLINE, but before sending that we must allocate a char* and set the first char to the size of the memory we just allocated. ie:
char tmp[128];
tmp[0] = '128';
int len = SendMessage(hEdit,EM_GETLINE,0,(long)tmp);
if (len == 0)
|
|
|
|
|
Ahhhh. That makes more sense.
|
|
|
|
|
What's wrong with sending the edit control a WM_GETTEXTLENGTH message?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello everyone!
Here, I have this statement:
#pragma once<br />
<br />
#include "Includes.h"<br />
<br />
class Game<br />
{<br />
Player mainPlayer;
<br />
VehicleType AllVehicles[1];
It generates these errors:
1>[dir]\Game.h(10) : error C2146: syntax error : missing ';' before identifier 'mainPlayer'<br />
<br />
1>[dir]\Game.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int<br />
<br />
1>[dir]\Game.h(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Why would it be? I'm pretty sure it's just some bad syntax I didn't see, that's why I included the surrounding lines... Any ideas? Thanks!
PS: Here's the declaration of Player :
#pragma once<br />
<br />
#include "Includes.h"<br />
<br />
class Player<br />
{<br />
int color;<br />
<br />
public:<br />
Player();<br />
<br />
SDL_Surface *surf;<br />
<br />
int x, y;<br />
<br />
bool Load(int color);<br />
<br />
bool SwapColors(SDL_Surface *surf, int color);<br />
};<br />
Windows Calculator told me I will die at 28.
|
|
|
|
|
#include "Player.h"
led mike
|
|
|
|
|
I think you are getting errors because you did not #include "Player.h" in Game.h . As you are creating an object of Player , therefore, the compiler should know what Player is.
Alternatively, you could try this syntax: (not always guaranteed to work)
class Player;
at the top of Game.h and #include "player.h" in Game.cpp .
this is this.
|
|
|
|
|
|
How about:
#pragma once<br />
<br />
#include "Player.h"<br />
<br />
class Game<br />
{<br />
...
Because includes.h is already included in Player.h . It should work.
this is this.
|
|
|
|
|
I am adding a single property page class to a property sheet a variable number of times in a modal dialog. Ideally I would like to adjust the tab caption from within the property page in response to a user adjustment to a caption edit field. Barring that, I would at least like to uniquely set the caption for each tab in OnInitDialog() or OnShowWindow() or from the property sheet on dialog startup. Calls to SetWindowText() seem to be happily ignored by the property page in those locations. Anybody have any experience/luck with this sort of thing?
Thanks in advance,
Scott
-- modified at 17:21 Monday 28th August, 2006
-- modified at 17:22 Monday 28th August, 2006
Scott P. Chapman
Voss Scientific Inc.
scottc@vosssci.com
|
|
|
|
|
Scott P. Chapman wrote: Anybody have any experience/luck with this sort of thing?
Use CTabCtrl::SetItem() .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi!
Could anyone help me change the font of a button's caption/text in MFC?
The button is created with the modal frame style. The problem is that when I try to modify the caption's font, the application crashes.
The code which creates the button is:
m_wndButton.CreateEx(
WS_EX_DLGMODALFRAME,
_T( "Button" ),
_T( "Test button" ),
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
CRect( 100, 100, 190, 140 ),
&m_wndView,
1,
NULL );
m_wndButton is the CButton object I'm trying to modify.
Can anybody give me a hint?
Thanks in advance!
|
|
|
|
|
Do you really need to create the button dynamically?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The application I am developing is Single Document (SDI). I do not have a dialog which can be modified at design time. The only dialog of this kind is the AboutBox. The button which I am trying to modify is contained on the main frame. It's on the child view exactly. I have no other choice (in my opinion), than to dynamically create the button.
|
|
|
|
|
m_wndButton.SetFont( &m_buttonFont);
where m_buttonFont is a CFont object declared in the View object and intialized to whatever font you desire or whatever.
led mike
|
|
|
|
|
Thanks a lot!!!
It finally works! The only thing that was wrong was the declaration of the CFont object: instead of declaring it in the CMainFrame class, it was declared in the same method the button was created in.
|
|
|
|
|
|
can we change the initial size of the onscreen keyboard???and also hilight the button we pressed???how about if i wan to create a button when pressed it automatically do this operation which is CTRL+ALT+DELETE...which we would wan to do it so that the task manager appear...how about creating shortcut key to application like Microsoft word and notepad...is it possible ?pls reply or help me cause i am doing a project on it...In need of help...!thx ....
|
|
|
|
|
You might also want to ask your question here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
ya i know ...i saw people asked about it but no one reply to it...so i try asking it here...
|
|
|
|
|
|
Hi.
How I can get listview subitem text of a listview on another process?
I want to get listview subitem text of a listview on another process using Windows API. I already have the listview handle and hooked to it.
Can someone help me?
Thx in advance.
Best Regards,
Marco Alves.
|
|
|
|
|
You have to alloc memory in the other process with VirtualAlloc (OpenProcess etc) and use the allocated memory with LVM_GETITEM, then retrieve back the memory into your process. There are probably a couple of samples on internet, but prepare yourself, is not so easy.
|
|
|
|
|
#pragma once
#include <vector>
#include <string>
#define MAX_LINES 100
#define MAX_FILENAME_LENGTH 100
#define MAX_SENTENCE_LENGTH 1000
#define MAX_WORD_LENGTH 25
using std::string;
class CSentenceList
{
public:
//Methods
CSentenceList(char strFileToRead[MAX_SENTENCE_LENGTH + 1], const bool bSorted = false);
virtual ~CSentenceList(void);
void sort();
unsigned int search(const string* strSearch);
string display(unsigned int iLineNumber = 1);
//Properties
unsigned int Size;
vector <string> Sentences; //ERROR
private:
//Methods
bool readFile(const char strFileToRead[MAX_SENTENCE_LENGTH + 1]);
};
Error:
c:\Documents and Settings\Jon\My Documents\Visual Studio Projects\IAD Practice and Assignment\C++ - Assignment\02 & 03 - Sentence\SentenceClass\SentenceList.h(25): error C2143: syntax error : missing ';' before '<'
I'm not sure what is causing this error because the syntax seems good...?
Jon
|
|
|
|