|
I can disable device in xp/2k by using the setup** functions.However, the same functions can not be used in 98/ME. Anybody can tell me how to realize the disabling device in 98/me?
please contact:
xiayi@ustc.edu
|
|
|
|
|
I can disable device in xp/2k by using the setup** functions.However, the same functions can not be used in 98/ME. Anybody can tell me how to realize the disabling device in 98/me?
please contact:
max_xiayi@hotmail.com
|
|
|
|
|
I am trying to create an app that, among other things, uses an MFC Doc/View architecture to display RTF files. I have the editing and display and all the standard stuff from a library (LED) that does an excellent job. Now I have to have a second window open, that shows a portion of the text from another view (lets for argument say the top two lines) blown up (or zoomed in) large. However, I have to have the resolution higher, not just StretchBlt the smaller image up and get a pixelated image. I have a mechanizm to open a separate Frame Window and View, and to transfer the selected text to it.
I thought I could manimpulate the Mapping Mode along with the Viewport and Window Extents to in effect change the DPI of a memory mapped DC. Then, just like when you print, in my OnDraw routine, I pass the DC to my view, let it render to the DC, and then Blit it over to my window.
When I set up my DC, and change it's mapping mode to MM_ANISOTROPIC, and then modify the Extents, everything seems fine when I create a font and call GetOutputTextExtent(), I get a value, and when I double the ratio of the Window to the Viewport Extents, GetOutputTextExtent() reports a value that is double. HOWEVER, when I then use TextOut, the text is the same size, unaffected by the extents. How can GetOutputTextExtent()report a different value than TextOut produces?
Below is some sample code, note the second and third lines from the bottom get the size and create the text, but they do not match:
CDC cdcScreen;<br />
cdcScreen.CreateDC("DISPLAY", NULL, NULL, NULL); <br />
ResizeableDC = new CDC;<br />
ResizeableDC->CreateCompatibleDC(&cdcScreen);<br />
<br />
int mode = ResizeableDC->SetMapMode(MM_ANISOTROPIC);<br />
ASSERT(mode == MM_TEXT);<br />
ResizeableDC->SetWindowExt(1024*20, 768*20);<br />
ResizeableDC->SetViewportExt(1024, 768);<br />
<br />
CFont font;<br />
{<br />
LOGFONT lf;<br />
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight = -MulDiv(12, ResizeableDC->GetDeviceCaps(LOGPIXELSY), 72);<br />
strcpy(lf.lfFaceName, "Arial");
VERIFY(font.CreateFontIndirect(&lf));
}<br />
<br />
CFont* def_font = ResizeableDC->SelectObject(&font);<br />
CSize Size = ResizeableDC->GetOutputTextExtent("Now is the time for all good men");<br />
<br />
ResizeableDC->TextOut(Size.cx, Size.cy, "Now is the time for all good men");<br />
ResizeableDC->SelectObject(def_font);
Any other ideas on how to get the results I need? The View class will render to a printer at a high DPI quite well, so I don't think I need to re-write the View code, I just have to figure out how to change the DPI of a DC!
Corey Cooper
|
|
|
|
|
I need to implement a listCtrl where one list (Master) is used to highlight and select items on this list for display on another list.
Are they any good examples. I have seen it used in many applications, but not found an example where you filter what you want to be displayed on the main ListCtrl.
grahamfff
|
|
|
|
|
One solution is SetItemState(). Pass in LVIS_SELECTED.
Kuphryn
|
|
|
|
|
Hi,
There's some problem in MFC's documentation about CTreeCtrl::SortChildrenCB method. The parameters in the callback function are not handles to the tree items but the datas of the items..
My problem is my tree can have subfolders and when i sort i want subfolders reside on the top ( alphabetically sorted within themselves ) and the leafs under them ( again alphabetically sorted ). I distinguish the subfolder and leafs with their data ( leafs being 0 and subfolders being some positive values ). So i can use the parameters of the callback function to separate subfolder from leaf but i couldn't figure out how i could get the item's text so that i can sort them...
Any help is appreciated. Thanks in advance.
|
|
|
|
|
Are you using the data values for anything other than parent/leaf determination? If not, you can set the item's data to be its HTREEITEM, so you have full access to the item's properties in the callback. If you do use the data for something else, create a data structure containing the data you need, and set the item data to be a pointer to an instance of this structure.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi Ryan,
I use the data to figure out which item item is leaf and which item is subfolder. Your first proposal came to my mind too but i used the data values too often in the project that replacing them HTREEITEMs will require quite an effort to modify the whole project. And the subfolders under a parent folder have all the same data so i guess the only unique value left for me is the HTREEITEM.
I think i'll have to implement my own sorting function if i can't come up with a better idea on reaching to HTREEITEM using callback function.
Thanks for your reply.
|
|
|
|
|
Can anyonme help me on finding info oin defragmenting a hard drive programatically. Are there any projects on CodeProjects?
gabby
|
|
|
|
|
Gabby,
You could always try www.sysinternals.com
http://www.sysinternals.com/ntw2k/info/defrag.shtml
This information is regarding the built in native support for disk defragmentation on NT and later.
The pointer also includes source code and examples.
Hope it helps
Regards
Darren
|
|
|
|
|
Thank you very much for your help.
I will check up the site right now
gabby
|
|
|
|
|
I've been working on a Phone Book program for a few days and have hit a snag on the graphical part.
I wanted 5 buttons with bitmaps (for home, mobile, work, ect) with text, to do that I would have to make them ownerdrawn, I did'nt want to go through the hastle of that.
I decided to make the buttons bitmaps, then when the mouse is over them change the styles to text to show the text.
I got that working fine but when you click the buttons (actually check buttons) they stay in there current state! When you mouse over the other buttons then come back to the one you just checked it works fine!
Here is the link to a zip with the source+workspace/exe http://www.kruncherinc.com/PhBk.zip
Please, any ideas?
wWw.KruncherInc.cOm
|
|
|
|
|
Are you Invalidate()ing the window of the button who's state changes? The window will only redraw itself in response to a WM_PAINT message- perhaps the action of moving the mouse is triggering this.
There are loads of graphic/bitmap button classes here on codeproject that would probably suit your needs. Yes, you'll need to apply BS_OWNERDRAW to a button for it to appear properly, but these classes will handle all of the details for you.
jon
using System.Beer;
|
|
|
|
|
Hi
I'm facing the following problem using AddFontResource function.
I've got Type1 fonts' files embedded in my programs resources. And I want make them(fonts) automatically install on programm startup and remove on programs shutdown. I'm doing the following:
1) extracting binary data from resources and saving them in temporary files
2) trying to add them by calling
AddFontResource("c:\\windows\\temp\\DIN-Bold.pfm | c:\\windows\\temp\\DIN-Bold.pfb");
But this function always returns 0.
The same procedure works well for single-file ttf fonts.
Could anybody help me to find out why it doesnt install pfm+pfb fonts.
I'll be glad to get any help from you.
|
|
|
|
|
I reckon there's a defect in MSDN - there should be no spaces surrounding the | character, i.e.
AddFontResource("c:\\windows\\temp\\DIN-Bold.pfm|c:\\windows\\temp\\DIN-Bold.pfb"); You might have more luck with that.
Untested, but there are some examples on Google's groups archive.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I'm looking for a library that can convert ASCII, Multibyte and WideChar strings to and from different UTF encodings
- at least UTF-8 and UTF-16
- free (preferrably with source)
- fast
Any sources?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
http://www.unicode.org/Public/PROGRAMS/CVTUTF/
From Unicode.org themselves
Handles UTF-8, UTF-16 and UTF-32.
There's also some UTF-7 code up there, if you care.
You can also use MultiByteToWideChar() and vice versa to do UTF8 and UTF16 conversions. See MS docs for the constants.
|
|
|
|
|
|
hi,
i'm tring to set up BlueTooth communication between 2 PDA's.
in my client side,i wrote this part of code:
WSAQUERYSET Wsaq;
ZeroMemory(&Wsaq,sizeof(Wsaq));
Wsaq.dwSize = sizeof(Wsaq);
Wsaq.dwNameSpace = NS_BTH;
Wsaq.lpcsaBuffer = NULL;
if(WSALookupServiceBegin(&Wsaq,LUP_RETURN_ALL ,&hlookup) == SOCKET_ERROR)
{
ErrorValue = WSAGetLastError();
ErrorString.Format(_T("%d"),ErrorValue);
AfxMessageBox(TEXT("WSALookupServiceBegin() Error
Number ")+ ErrorString);
return;
}
.
.
.
also,in my header file there is #include<winsock2.h> & i've imported ws2.lib,
but i always gets this error:
BTexampleDlg.obj : error LNK2019: unresolved external symbol "int __cdecl
WSALookupServiceBeginW(struct _WSAQuerySetW *,unsigned long,void * *)"
(?WSALookupServiceBeginW@@YAHPAU_WSAQuerySetW@@KPAPAX@Z) referenced in
function "protected: void __cdecl CBTexampleDlg::Onstart(void)" (?
Onstart@CBTexampleDlg@@IAAXXZ)
ARMV4Rel/BTexample.exe : fatal error LNK1120: 1 unresolved externals
(i've got the same error with WSALookupServiceNext() function and
WSALookupServiceEnd() function).
can someone please help me?
my email is : Eliv@Roadeye.co.il
thanks,eli.
|
|
|
|
|
|
Have you imported "ws2_32.lib" ?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hello,
I would like to know whether it is possible to listen to a specific EM_/EN_ message from CEdit informing the caret has been moved to a different position? Is there such a message? Or do I have to listen to the OnChar event and from there call GetSel(...,...) to know the caret position?
All comments are very appreciated,
David
|
|
|
|
|
Hi..
I have created some directories and sub directories using the Unicode function "CreatedirectoryW()" as the full path exceeds 260 chars..and it was succesful from the code point of view..
Though I created these when i decided to access them from windows I couldn't do so..It is throwing an error that "can't access this folder.Path is too long"..
If this is the case what is the purpose of Using Unicode function to create directories which exceeds 260 chars limit??
Is there anyway we can access these files???
Thanks
Sudhakar
|
|
|
|
|
Sudhakar Pasupunuri wrote:
If this is the case what is the purpose of Using Unicode function to create directories which exceeds 260 chars limit??
Is there anyway we can access these files???
You can access paths over 260 characters by adding "\\.\" to the beginning of the filename. Remember to escape the backslash.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for the valuable info But my question here is :
I want to acceess these files from windows explorer and not through code..
The end user want to open the file and want to see the contents using windows explorer..But then windows throws error that "cann't access the folder/file path is too long "..
Plz help me out in this..
Thanks
Sudhakar
|
|
|
|