|
Read up in the MSDN on the function CreateWindowEx. I believe that in order for you to use the RICHEDIT_CLASS you must first call the RegisterClass or RegisterClassEx to register your RICHEDIT_CLASS.
If the function succeeds, the return value is a class atom that uniquely identifies the class being registered. This atom can only be used by the CreateWindow, CreateWindowEx.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
i don't know if this is it, but does your application need to call AfxOleInit()?
[insert witty comment here]
bdiamond
|
|
|
|
|
SuperTank wrote:
Anyone got any idea whats wrong?
How about calling GetLastError() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I acctualy got it working. All I had to do was to add LoadLibrary("Riched20.DLL");
It seams to be very common fault.
humpa humpa
|
|
|
|
|
I am deriving from CStatic class to create a CStatic with customized font and coloration .
But my problem is that during creation how do I and where do specify the Font to be used ?
|
|
|
|
|
|
you can create the font in the constructor; you might need to override the Paint method.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Is it possible to declare a series of variables and then assign a pointer to the start (i.e. the first variable).
I wish to use a user defined database which will hold the display format, type and an offset into the variables location in memory.
Basically I will fill an array of item details and declare the items;
e.g.
static ITEM_DETAILS items[NO_ITEMS] = {<br />
"%0.2f", display format<br />
"float"
"£",
"Current Cost"
, "0000"
<br />
"%d", display format<br />
"unsigned short"
"N/A",
"Number of Units",
"0004"
<br />
etc<br />
}; Now the items will be declared as follows:-
float cost;
unsigned short noOfItems;
CString itemName;
etc
Now my question is how do I go about declaring a pointer to the first variable (start of the memory that the variables are held) and is it OK to add offsets to this pointer, i.e. to obtain data item2 (noOfItems which has the offset 0004)
e.g.
LPVOID ptr = &cost; // Pointer to the start of the memory location
so to access the item noOfItems I would do the following:-
int offset = atoi(items[1].offset);
data = *(ptr + offset);
I need the variables in contagious memory and is a LPVOID the right choice.
I was thinking of shared memory, but I have always used a structure to access items and not a general pointer.
Any help please.
|
|
|
|
|
Check the macro offsetof, it would be what you need
It is used along with a structure.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks for the info, however I have a problem with the bit fields (I know that you cant use the macro with these fields) but its the extra byte thats the problem, as I could just manage the field fileds aa a 2 byte hex item.
#pragma pack(1)<br />
typedef struct<br />
{<br />
unsigned short i; <br />
float f; <br />
char c; <br />
unsigned short bit41 : 4;<br />
unsigned short bit42 : 2;<br />
unsigned short bit43 : 1;<br />
char s;<br />
unsigned short x;<br />
double y;<br />
double z;<br />
} SFOO;<br />
<br />
union<br />
{<br />
SFOO fields;<br />
unsigned short buffer[32];<br />
}test_data;<br />
<br />
#pragma pack()<br />
<br />
void main(void)<br />
{<br />
printf("Offset of 'c' is %u ", offsetof(SFOO, c));<br />
printf("Offset of 's' is %u ", offsetof(SFOO, s));
This gives Offset of 'c' is 6 Offset of 's' is 9; I was expecting 8, see below:-
f f i i
Bits c f f
x x s
y y y y
y y y y
z z z z
z z z z
|
|
|
|
|
The bit fields gave me a problem with the offsetof.
See new post
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=908749
|
|
|
|
|
raed wrote:
BOOL b = dbRecord.CanUpdate();//here Debug assertion failure rasied ,WHY?
I don't know, you tell us. You should have been presented with a message box containing the file name and line number of the failed assertion. Given those two, we might be of more help.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Dear:
the message box information that appear will assertion failure occured
Debug Assertion failure
....
File: f:\vs70builds\9466\vc\MFCATL\ship\atlmfc\include\afxdb.inl
Line: 58
....
....
thats all
Regards
|
|
|
|
|
The CRecordset::CanUpdate asserts on this and If the recordset is open, and since u didnt open it it gave u the assertion, thus my suggestion to Check CRecordset::Open
afxdb.inl:
----------
ASSERT_VALID(this);
ASSERT(IsOpen());
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
ok,i check IsOpen() for recordset and return that the recordset is not Open , but when i open the record set like this:
CDatabase database;
database.OpenEx("DSN=HomeDSN;uid=sa;pwd=");
CRecordset record(&database);
record.Open(AFX_DB_USE_DEFAULT_TYPE,"SELECT * FROM Clients",CRecordset::none);
...
..
it works fine
but when do this:-
record.Open(AFX_DB_USE_DEFAULT_TYPE,"UPDATE Clients SET ClientName = 'Sam' WHERE ClientID ='00014'",CRecordset::none);//Assertion occured
WHY?
Thanks
|
|
|
|
|
Hi,
I've got a single document application that has a CFormView for the main window, then inside the CFormView I have a CTabControl that uses a custom CDialog class for each tab. I would like to move the event handling from the main CFormView class to the CDialog class for each tab. When I add a event handler to the dialog class it never gets called. Is this how you would code a tab control and why doesn't this work?
Thanks
Hua-Ying
|
|
|
|
|
Hi All
i have an application in which i use a ini file to store settings,
the user reads and writes to it
i use WritePrivateProfileString to write to the ini file
and GetPrivateProfileString to read from it
my problem is, is a lot of people who use my application do not
have admin rights..so cant write back to to the ini file
does anyone know a way round this ??
ive thought about using the registry, HKEY LOCAL MACHINE you need admin
rights for
I cant use HKEY CURRENT USER as there may be many users using my app
all who share the same settings,
Any one any ideas ????
ta
si
|
|
|
|
|
si_69 wrote:
a lot of people who use my application do not
have admin rights..so cant write back to to the ini file
In what folder does the .ini file reside?
si_69 wrote:
I cant use HKEY CURRENT USER as there may be many users using my app
all who share the same settings,
That's what that hive is for. If three people use the same machine, they each need their own settings saved to the HKCU hive. If there are settings that need to be in effect regardless of who is using the machine, then those go in the HKLM hive.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
In what folder does the .ini file reside?
its stored in the application folder off program files
c:\program files\myapp
does that make a difference ?
DavidCrow wrote:
If there are settings that need to be in effect regardless of who is using the machine, then those go in the HKLM hive
the problem with that is you cant write back to HKLM in non administative mode and the
user doesnt have adminostrator rights
|
|
|
|
|
si_69 wrote:
its stored in the application folder off program files
c:\program files\myapp
does that make a difference ?
Only if the user of the application does not have 'write' access to that folder, which they probably shouldn't. In reality, the INI file(s) should be stored in the C:\Documents and Settings\<username> folder, or a subfolder thereof. This is a folder that users will have 'write' access to.
si_69 wrote:
the problem with that is you cant write back to HKLM in non administative mode and the
user doesnt have adminostrator rights
Normally there's no need. When I install the software on a PC, I do so as the domain administrator so that application-wide settings are stored in the HKLM hive of the registry. When I configure the software, I do so as the person that will eventually be using it so that user-specific settings are stored in the HKCU hive. Make sense?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I need a VERY GOOD tutorial with many examples of ws2 use.
Post links here, plz.
I read several, but most of them sux. Authors only showing struct and use of the functions. I know what is doing accept() func, but I don't know why should I use it =\ the same is with bind() etc.
My problem is: I have a client of the game. I want to connect my application with this - send and recv packets.
Does any one of you know how to help me?
_________<br />
I'm made in C++... and I'm proud of it!
|
|
|
|
|
There's a really good book called "Network Programming with Windows Sockets" that taught me everything. Also with the help from tutorials on codeproject.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Do u have a link to it?
_________<br />
I'm made in C++... and I'm proud of it!
|
|
|
|
|
Look on Amazon. Also take a look at Win32 Network Programming. Very good book. Can find this on Amazon.com too.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
http://Sockets.com[^]
Watch out! I'm a CPian on the edge!
I have a new Gold rating and I'm not afraid to use it! -pete
|
|
|
|