|
Hello Friends
I am creating a MFC application in which adding Scrollbar to CDialogBar. But its not showing automatically when i open a file which displays some boxes in CDialog. When I click on scroll bar then only its showing up otherwise not.
Here am using like this to display scrollbar.
SetScrollRange(SB_VERT,0,4,TRUE);
SetScrollPos(SB_VERT,0);
ShowScrollBar(SB_VERT);
Thanks & Regards
Yogesh Sikri
|
|
|
|
|
Hello Mr. Sikri,
Please refer to the following:
http://msdn.microsoft.com/en-us/library/zz1h061h%28v=vs.80%29.aspx
You may find it useful to you problem.
Hope this helps!
Best of Luck!
With Kind Regards,
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:34am.
|
|
|
|
|
When pasting links into answers please make sure they are clickable, by using the "link" or "[^]" controls above the edit box.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hello everybody,
Does anybody know how to put commands in a ribbon markup file (for example a ribbon.xml )?
Here's the code:
<?xml version='1.0' encoding='utf-8'?>
<Application xmlns='http://schemas.microsoft.com/windows/2009/Ribbon'>
<!-- Commands section -->
<Application.Commands>
<Command Name="cmdTab1"
Comment="The main tab of the ribbon."
Symbol="cmdTab1"
Id="500" >
<Command.LabelTitle>
<String Id ="501">Home</String>
</Command.LabelTitle>
</Command>
<Command Name="cmdButtonKillUapps"
Comment="Kill all user mode applications on the computer."
Symbol="cmdButtonKillUapps"
Id="11111" >
<Command.LabelTitle>
<String Id ="1214">Kill U. Applications</String>
</Command.LabelTitle>
<Command.LargeImages>
<Image Id="7097">res/kuAppsBlue.bmp</Image>
</Command.LargeImages>
<Command.SmallImages>
<Image Id="9802">res/kuAppsBlue16x16.bmp</Image>
</Command.SmallImages>
</Command>
<Command Name="cmdButtonKillKapps"
Comment="Kill all kernel mode applications on the computer."
Symbol="cmdButtonKillKapps"
Id="2222" >
<Command.LabelTitle>
<String Id ="5498">Kill K. Applications</String>
</Command.LabelTitle>
<Command.LargeImages>
<Image Id="2322">res/kuAppsBlue.bmp</Image>
</Command.LargeImages>
<Command.SmallImages>
<Image Id="1047">res/kuAppsBlue16x16.bmp</Image>
</Command.SmallImages>
</Command>
<Command Name="cmdButtonBlnkScrn"
Comment="Lock up and out computer of people on client(s)."
Symbol="cmdButtonBlnkScrn"
Id="502" >
<Command.LabelTitle>
<String Id ="503">Blank Screen</String>
</Command.LabelTitle>
<Command.LargeImages>
<Image Id="504">res/bscreenBlue_ico.bmp</Image>
</Command.LargeImages>
<Command.SmallImages>
<Image Id="505">res/bscreenBlue_ico16x16.bmp</Image>
</Command.SmallImages>
</Command>
<Command Name="cmdButtonDisaIn"
Comment="Turn off mice(s) and keyboard(s) as if the devices were unplugged from the computer."
Symbol="cmdButtonDisaIn"
Id="599" >
<Command.LabelTitle>
<String Id ="510">Disable Input</String>
</Command.LabelTitle>
<Command.LargeImages>
<Image Id="519">res/key_blanklock.bmp</Image>
</Command.LargeImages>
<Command.SmallImages>
<Image Id="554">res/key_blanklock16x16.bmp</Image>
</Command.SmallImages>
</Command>
</Application.Commands>
<Application.Views>
<Ribbon>
<Ribbon.Tabs>
<Tab CommandName="cmdTab1">
<Group CommandName="cmdGroup1" SizeDefinition="ThreeButtons">
<SplitButton CommandName="cmdButtonKillUapps">
<Button CommandName="cmdButtonKillKapps" />
</SplitButton>
<ToggleButton CommandName="cmdButtonBlnkScrn" />
<ToggleButton CommandName="cmdButtonDisaIn" />
</Group>
</Tab>
</Ribbon.Tabs>
</Ribbon>
</Application.Views>
</Application>
Like when I hover my cursor with my mice over a command it should show a box showing a title and a concise description of what it basically does.
I am using the Windows 7 S.D.K. with Visual Studio 2010 and comping this through an external executable called uicc.exe .
Simple Thanks and Regards,
Brandon T. H.
Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst).
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
modified 27-Dec-12 20:48pm.
|
|
|
|
|
|
Yes, exactly what I was looking for, but how do you add return/enter spaces?, in C++ in a console application it is \n .
Simple Thanks and Regards,
Brandon T. H.
Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst).
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison
|
|
|
|
|
Follow the "See Also" link.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Sorry, fat fingers, it just got posted before I fixed the formating!
<pre lang="text">
Could someone please explain this or give me some reference?
I am processing WM_DEVICECHANGE and trying to get info on the USB device (LittleWire ). I think I got the basic figured out, but do not quite get the casting from from wParam to device "dbcc_name".
From PDEV_BROADCAST_HDR to PDEV_BROADCAST_DEVICEINTERFACE.
How does C++ compiler does this since the structures definitions are not same?
</pre>
<small></small> if ( DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam ) {
// cast to generic structure
PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam;
// define specific device type structures
PDEV_BROADCAST_DEVICEINTERFACE pDevInf;
PDEV_BROADCAST_HANDLE pDevHnd;
PDEV_BROADCAST_OEM pDevOem;
PDEV_BROADCAST_PORT pDevPort;
PDEV_BROADCAST_VOLUME pDevVolume;
// analyze specific device type
switch( pHdr->dbch_devicetype ) {
case DBT_DEVTYP_DEVICEINTERFACE:
{
// cast to DBT_DEVTYP_DEVICEINTERFACE
pDevInf = (PDEV_BROADCAST_DEVICEINTERFACE)pHdr;
CString strName = pDevInf->dbcc_name;
//CString strGuid = pDevInf->dbcc_classguid;
TRACE("\nDEvice full name %s", strName);
//TRACE("\nDEvicre full guid %s", strGuid);
|
|
|
|
|
Casting in C++ does not change anything, it just tells the compiler that the basic type or pointer that you have defined will actually be used to point to something else. It is your responsibility to know what you are doing. Windows messages pass pointers in the WPARAM or LPARAM fields, and you need to cast them to the correct type before you can access the structure that they point to. In your case above, you cast the lParam item to the generic PDEV_BROADCAST_HDR so you can find out what type it is, and then you cast that pointer to the specific structure pointer as defined in the header.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thanks,
you helped me to realize that the "orignal" lParam PDEV_BROADCAST_HDR structure contains the PDEV_BROADCAST_DEVICEINTERFACE structure.
So the cast did not point to anything unknown.
I missed that.
Thanks
|
|
|
|
|
Yeah, you often get neted structs in Windows, with a base type at the start and other structs after that in memory, so there is lots of casting rom one type to another whcih is just to access the 'extended' data.
==============================
Nothing to say.
|
|
|
|
|
Dear Friends,
I have 11thousand PDF file and I need to take a log of number page in each PDF document and I decided to make tool to read the number pages in each PDF document. Anyone can help me. I have VC6 and visual studio 2008.
Thanks and Regards,
S.Shanmga Raja
|
|
|
|
|
You need to get hold of one of the PDF libraries available on the internet, or use the documentation available on the Adobe website to write your own. You can then read your PDF files and get information about the content.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi Shanmuga,
As Richard suggested, you've to use some thirdparty PDF SDK/library to get the pdf page count.
One option would be - QuickPDF Library[^] which is a absolutly free.
You can use the api - DPLPageCount()[^] to get the page count.
Have a look at their samples(well documented) about how to initialize the library and use it.
Hope this helps.
Best Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks.
|
|
|
|
|
As you may already know, new string literals in C++ 11 can be expressed in a very flexible way.
R"<delim>...<delim>"; - in this code the <delim> can be pretty much everything and also no escape characters are needed. Any kind of parentheses can be used to delimit the end of string, Raw string literals are especially useful when defining regular expressions:
R"(I love those who yearn for the impossible. (Von Goethe, "Faust"))";
Blocks of text can be simply defined using equal occurrences of same characters:
R";***************************( ; TINY BASIC FOR INTEL 8080
; VERSION 2.0
; BY LI-CHEN WANG
; MODIFIED AND TRANSLATED
; TO INTEL MNEMONICS
; BY ROGER RAUSKOLB
; 10 OCTOBER, 1976
; @COPYLEFT
; ALL WRONGS RESERVED ) ;***************************";
More information can be found here http://en.wikipedia.org/wiki/C++0x#New_string_literals[^] (Wikipedia).
I want to implement it with C++ processor, here is what I have. Now double quotation marks are not supported, and I need to compete it like C++ 11. Can anyone help me?
#define STR(a) #a
#define R(var, re) static char var##_[] = STR(re);\
const char * var = ( var##_[ sizeof(var##_) - 2] = '\0', (var##_ + 1) );
You can use it like this:
R(re, "\w\d");
The code is not friendly to use. So I want the feature like C++ 11 raw string literals.
PS: I'm using Visual C++ 2010, the new feature is not supported, I must implement it by myself.
|
|
|
|
|
I understand that the reason the ret variable will not print (it's at the end of the string when destination is passed) but can't figure out how to return destination out of the my_strcpy() function. I can make this work using array notation but not pointer arithmetic. Here's the code in question:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char *my_strcpy(char *, const char *);
int
main()
{
char *strA = "This is a string";
char *strB;
char *ret;
strB = malloc(strlen(strA)+1);
ret = my_strcpy(strB, strA);
puts(ret);
puts(strB);
free(strB);
return 0;
}
char *my_strcpy(char *destination, const char *source)
{
while (*source != '\0')
{
*(destination++) = *(source++);
}
*destination = '\0';
return destination;
}
|
|
|
|
|
Just use a local variable for copying or save the value of destination in a local variable to be returned upon exit:
char *my_strcpy(char *destination, const char *source)
{
char *ret = destination;
while (*source != '\0')
{
*destination++ = *source++;
}
*destination = '\0';
return ret;
}
|
|
|
|
|
In addition to Jochen's comments, you also need to allocate some memory to strB before calling your copy function. The code above will be copying into some random place and probably crash.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
He allocates memory using malloc() . You may have overlooked the line just above the copy call.
|
|
|
|
|
Oops!
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi,
It seems that I have problem drawing ownerdrawfixed combo box, which is actually drawn in ownerdraw listbox control.
I am able to draw all items inside shown dropdown of combo box. But I can not draw anything to combo box "header".
1. What is actual message of drawing combobox "header" ? I got to conclusion that when itemID is -1 (after I call CB_SELECTSTRING) then it is "header" (Note: Seems that right rect is found in DRAWITEMSTRUCT) and I draw text than but nothing appears.
2. Currently I am trying to draw it after CB_SHOWDROPDOWN is set to true. Should it be done before that?
|
|
|
|
|
I'm guessing, handle the WM_DRAWITEM message in the parent window, then check the CtlID
member of DRAWITEMSTRUCT to see it's the correct combobox control, if so check the itemState member to see if it is ODS_COMBOBOXEDIT, and if so, draw the edit box (I think the edit box is what you mean when you say "header")control of the combobox.
Hope it helps.
|
|
|
|
|
Hi,
I have one question regarding resolution. How to make a project created as a MFC dialog based application, resolution independent. I am using a number of images in our dialog based project. But the final display using images and controls is not resolution independent. To say if your PC screen resolution is different from the other, it will not properly display the dialog. Some of the part of dialog display will be cut-off.
How to make the same resolution independent, so that irrespective of the resolution of the device or screen size, display should be same.
Any help will be appreciated.
Also, what is the use of ActiveX controls in MFC.?
Regards,
Mbatra
|
|
|
|
|
I assume that your dialog is created using a resource template.
The simple solution is to limit the size of the dialog to the minimum size of supported screen resolutions.
If your application must also run on small screens, you may add a second dialog template with smaller controls and smaller total size. Upon program start, choose the small template when necessary.
The complex solution would be making your dialog and some or all controls resizable. But this requires proper calculation for sizes and positions of all controls.
Regarding ActiveX
There is no need to use ActiveX controls if your application design can be done using the standard Windows and MFC controls. If you have special control requirements, you can build your own controls by using ActiveX or plain C++ code, or use existing controls that fit your requirements. Finally, it's up to you to decide to use ActiveX controls or not.
|
|
|
|
|
Hi,
Thanx for your reply.
It is not that my project will run on smaller screeens only. It may run on larger screens also.
Let me explain, I have windows 7 & my PC screen is of bigger size (vertically as well as horizantally) (bigger than a normal LCD display). if I run my project on my PC, I am not able to see the controls on the bottom of the dialog. if I run my project on any PC with windows XP and screen size is small, it will display it perfectly.
I want to make it like that all the controls should adjust them accordingly irrespective of the resolution or PC screen size.
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|