|
HBRUSH b = CreateSolidBrush(255);
SetLastError(0) ;
if( DeleteObject(( HGDIOBJ)b) )
{
printf( "brush deleted\n" ) ;
}
DWORD dw = GetLastError() ;
printf( "%d" , dw ) ;
----------------------------------
the above code returned..
brush deleted
0
when i debuggin this app gdi object count is incremented by one from 4 to 5(on windows taskmanager) when calling CreateSolidBrush, the deleteobject function return success but the gdi object count is still at 5.
iam using vs2003 under winxp sp2
thanks....
|
|
|
|
|
I had faced the same issue regarding the brush and pen objects. But I failed to get a solution.
See my post in CP[^]
- NS -
|
|
|
|
|
If you have the GDI object selected into a DC at the time of the DeleteObject() , the object will not be deleted. You must first use SelectObject() to restore the original object, before using DeleteObject() .
|
|
|
|
|
But this issue is not due to that. Even if we just create a brush and delete it very next, this issue exists.
- NS -
|
|
|
|
|
|
hi
since when Apply is clicked in a property sheet, its OnAplly() calls updateData() for the active page and initializes an ELLPROP structure with the settings, then sends a message to the main window containing the structures address.The main Window forwads the massage to the view (so far so good),the view copies the property values to its own data members (comes the problem) -suppopse i have many property sheets,each one will have an OnApply() that will fill the ELLPROP Structure with its own values, the mainframe will handle OnApply Once like this
LRESULT CMainFrame::OnAplly(WPARAM wParam,LPARAM lParam)
{
m_wndView.SendMessage(WM_USER_APPLY,wParam,lParam);
return 0;
}
then the view also will handle it once
..view::OnAplly(WPARAM wParam,LPARAM lParam)
{
ELLPROP* pep = (ELLPROP*)lParam;
// my question what do i do here (if am supposed to do it only here) if i have multiple property sheets
// lemmi give an example i may think of using proprty sheets insead of very many dialog boxes to write a simple school management program.
so one property sheet be for registration (first page studets reg, 2nd page staff reg,3rd page, members reg ..), another property sheet will be for finance (1st page setting the fees charges,2nd page payment of fees, 3rd page payment os salaries and wages to workers, 4th page payment of bills ..)
know i want each to update a database using ADO so each property page will have to open an appropriate recordset and do that(i havent tried the database part and know whether it will bring problems too),what i have tried is to have all the input values sent to the view so that i can display them in the client area and i dont know how the view's member variables will copy all these values that are coming from different property sheets and each sending an ELLPROP structure..(should i have some kind of control to know that this structure is from the finance sheet so just copy the finance deatils and leave the registration details- and if so how do i control that)
.......
.....
}
am new to MFC (4 mths know) so please if you can give me more deatils i'll rilly appreciate,thanks.
i h
-- modified at 2:28 Monday 13th August, 2007
|
|
|
|
|
Can you reword the question, to others understanding ?
Prasad
MS MVP - VC++
|
|
|
|
|
king`ori wrote: each property page will have to open an appropriate recordset
This is a flaw in your design: The document should hold the connection to the database, and the views (a property sheet is a view) access the property sheet.
This holds true even if your application does not use MFC Doc/View.
This paradigma is called model/view/controller and is independent of the toolkit used. You just might have to code more yourself.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
HAI Everybody,
I am doin chat program between client to client thro server. In my chat i am providing different font styles,if i choose a fontstyle then the same font styles has to send it to another client.
currently the data alone is sending and receiving. The selected styles are displayed in sender richEditbox, but in receiver side the styles are not coming...default font's only coming......How to do this...?
I am doin this all in MFC...
Please Help me.
Mani
|
|
|
|
|
Are you sending the styles too through the network? I think you r sending plain text message only through the network to the other client. If so you must send the styles too, in some format along with the message text and then use this style at the other end's to display it.
|
|
|
|
|
hai Ktm Techman,
Yes, Ur correct...I am sending the plain text only, But How to send the font styles also.How can I send Font styles ? Whether any API is there....or If you know any examples code pls send it to me.....
|
|
|
|
|
It depends upon the protocol you are using. If you are using your own protocol, either you can use HTML/RTF tags, and parse it upon receiving, and display accordingly, or u can make your own cool way, like,
Text: " ";Font:"Arial";Bold:1;Underline ;StrikeOut; ....
Or
U can even send the Font style object as binary data (if your protocol supports), cast it at the other end,
like Text:"Msg";Font object
|
|
|
|
|
How is ULONGLONG related to unsigned int64? I guess the length of this primitive type is 8 bytes?
|
|
|
|
|
In a Windows app, a ULONGLONG is an alias for a unsigned __int64.
It's 8 bytes long, yes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
My project based DCOM RPC run slowly on Windows20003 Server.
But on Windows2000 or Windows XP there is no problem.
Someone would like to tell me why?
Thanks
GOOD LUCK
|
|
|
|
|
I have a DCOM based VC project.
I use RPC to query database(using SQL Server 2000).
But when the Server program run on Windows 2000 server,the client using the data querying well,that I mean query speed is not slow.
But when I run the service on Windows 2003 Server,the client's query speed is almost as slow as 1 of 8 of running in Windows 2000 Server.And if the Server is runing on Windows2003 Server,no matter where the client is,the query speed always very slow.But if change the Server to Windows2000 Server,no problem!
I don't know the the reason is the DCOM surport differences of Windows2003 Server betwen Windows2000 Server or other feature differencs between the two OS.
Perhaps such problem should be appear on COM messageboard,but if so,I am sorry,I had post it one day before but no one had read it.And there also was not a message posted after my message.And the problem occur yesterdy before when my database system was tested by the customer.So,I need every information and help about this.Thanks
Someone would tell me Why?
Thank you again.
GOOD LUCK
-- modified at 16:36 Sunday 12th August, 2007
|
|
|
|
|
the most important issue is to get CD-key of Windows OS, and other unique information.
thx.
|
|
|
|
|
If I were microsoft, I'd make it so that you can't get that. Seems like a spyware security loophole... letting software steal a legitimate CD Key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Ok, so did the rabbit eventually get caught, or was he lost forever?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My program designed to be use only on Windows with Thai setting.
If the user's windows had a american date/time format It will not work as expected
Is there anyway to get the information of current standard/format using
MFC or win32API function ?
I want to do something like this
<br />
if(CurrentDateTimeFormat() != thai){<br />
MessageBox("Please set region & format to thai before using","noticed",MB_OK);<br />
EndDialog(0);<br />
}<br />
thank in advance
|
|
|
|
|
Maybe GetThreadLocale() will get the info you need.
Also, GetLocaleInfo() can be used to get strings showing the proper
format for dates and times for the current locale.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can use
GetUserDefaultLCID to detect users default Locale ID.
With GetLocaleInfo( lcid, LOCALE_ICALENDARTYPE,... )
you can check if you have a thai calendar for example.
This function gives you a detailed information about users formating settings.
|
|
|
|
|
xanagan wrote: If the user's windows had a american date/time format It will not work as expected
This is a bad design, IMO. The user should be allowed to change their date/time format to their liking, and your program should not care one way or the other.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i have some data stored in MSSQL database. I have made the connectivity of my MFC exe through ODBC. Can somebody tell me how can i view the table on my front-end??
|
|
|
|
|
Is this a C++ question?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|