|
Hi.
I am trying to implement a basic static toolbar. Here is the design.
- create a dialog box
- add a button (just consider one button for now)
- use CDialogBar to create the dialogbar at construction
- use GetDlgItem(IDC_Button) to get a pointer to the button
Okay. The design above works well. I have two major problems. First, the button does not look like a normal button. The button looks flat and is out of focus. Secondly, I am not sure where to add the message handler for the button.
What I have done is difficult to explain. I hope the brief explanation above is enough. Here is a simple code for it.
-----
CDialogBar m_MyDlgBar;
CButton *m_pButton;
int CMainFrame::OnCreate()
{
...
if (!m_MyDlgBar.Create(this, IDD_MYDLG, CBRS_BOTTOM, IDD_MYDLG))
{
TRACE0("Panel creation failed");
return -1;
}
m_pButton = reinterpret_cast<cbutton *="">(m_MyDlgBar.GetDlgItem(IDC_BUTTON));
ShowControlBar(&m_MyDlgBar, TRUE, FALSE);
-----
So basically, I need to somehow set the button to look like a normal button. Secondly, I need to know where to add a message handler for the button.
Thanks,
Kuphryn
|
|
|
|
|
Okay. The solution is to update the button with ON_COMMAND_UPDATE.
Kuphryn
|
|
|
|
|
Does anyone know of a good freeware source code printing program. I use to have a great program, but have recently re-imaged my machine and can't remember the programs name. If anyone can recommend a good utility it would be most appreciated.
- SAK
|
|
|
|
|
http://sources.redhat.com/sourcenav
|
|
|
|
|
I have a few issues with this. I haven't changed anything from the standard File->Open message handler. My app crashes if I try to select File->Open without saving or performing some other file operation first. If I open a file, I can't say File->Open until after I have either closed the current file or saved it or something like that. I'm not sure why this is happening since I haven't touched any of that code. Does anyone have any thoughts about where I can look to try to figure this one out?
|
|
|
|
|
A little more info. It looks like I'm having a problem getting junk data in a lot of my variables in the app. for instance, the filename string being passed as "filename" to the DoPromptFileName procedure used to open the Open File dialog contains the maximum (260) possible number of characters in it. They are junk characters, though. What's weird is that the informaion is placed in the variable upon declaration of the variable. Any ideas. This is becoming a real issue for me.
|
|
|
|
|
So, I've set my application up to resize the drawing when the window is resized by the user so that it keeps the same ratio of object to window size etc... Not sure if that's clear or not but I'll continue anyway. When I print, it prints fine when the window is maximized and everything in the window is in it's natural position in the maximized window. If the window is smaller, thus setting the drawing to be smaller so that it fits in the new window size, the print out is smaller as well. Only stands to reason, right? Well, I'm trying to figure out a way to print and always print as if the window was maximized regardless of the window's size. Any ideas?
|
|
|
|
|
Yeah, I'm using CView::OnPrint() but I don't understand the printing process enough to understand what the code is trying to do. I don't know how to modify it to, basically, zoom in on the CView client area to get the printout to look right.
|
|
|
|
|
The GetClientRect(...) method always returns the size of the client area on the screen, even when printing. You need to use something like the CPrintInfo::m_rectDraw when drawing to the printer. You can save the print rect in CView::OnBeginPrinting(...) and use the pDC->IsPrinting() to flag using the printer rect vs. the client rect.
This opens up a whole can of worms when trying to use your dynamic screen drawing code to draw to the more static printer page. There are other ways to get the printer page information. Search the MSDN for "get default print info" and see what you get. Of course this all opens a bigger can of worms.
You may want to just try using CPrintInfo::m_rectDraw first. It may be all you need.
Good Luck
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Hi !
I wrote system hook for right mouse click i.e. using WH_MOUSE in SetWindowHookEx()
Now for the hook procedure in the .dll file I added the code..
//=====================================================
EXPORT LRESULT CALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam)
{
switch(wParam)
{
case WM_RBUTTONUP:
{
DisplayDialog();
return CallNextHookEx(hK,nCode,wParam,lParam);
}
default:
return CallNextHookEx(hK,nCode,wParam,lParam);
}
}
//======================================================
// The above code should display a Modless Dialog Box on screen .. when it intercepts a Right mouse click.
The problem I am facing here is that though the dialog box does pop up...instead of one ... they are multiple in number and keep on increasing !!!
I traced the whole execution and found that the hook procedure was receiving multiple WM_RBUTTONUP messages when I just right clicked once.
Why is this happening ?
Another thing.. What do I do if I wanted to check if the
Shift key was pressed when right click was made.
Do I have to install a Keyboard hook for this, or can I get the info from wParam itself.
Please Help
DB
Note:
1. DisplayDialog() function displays a dialog box on screen.
2. Variable hk stores the hook handle from SetWindowsHookEx function.
|
|
|
|
|
Is it possible to use RDS.Dataspace from Visual C++ to call a remote server with the http protocol. I can do this from VB, but I can't make it work from VC++.
Any comments ?
|
|
|
|
|
I am using WebBrowser control in VC++ project.
WebBrowser loads page form Intranet Server. I don't want to show message like "The page cannot be displayed" in case server is down. I want to show some local html page which will be stored on client computer.
Does anyone know how to catch event when page is not successfully loaded from server?
Thanks
Sanjeev.
|
|
|
|
|
You could try first testing the existence of the page programatically (just send a HEAD request - don't download the page). If the test succeeds, ask the web browser control to load the page. Otherwise, direct the control to a local 404 page.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
HANDLE SAHeap = HeapCreate( HEAP_GENERATE_EXCEPTIONS , 0 ,0 );
PSECURITY_ATTRIBUTES pSD = NULL;
ACL_SIZE_INFORMATION ASizeInfo;
DWORD LenNeeded , iAce;
BOOL DaclF , AclDefF;
BYTE DAcl [256];
BYTE AType;
PACCESS_ALLOWED_ACE pAce;
PACL pAcl = (PACL) &DAcl;
POSITION pos = filelist->GetHeadPosition();
for(short i = 0 ; i < filelist->GetCount() ; i++ )
{
GetFileSecurity( (LPCTSTR)filelist->GetNext(pos).GetString() , OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION , pSD , 0 , &LenNeeded );
pSD = (PSECURITY_ATTRIBUTES)HeapAlloc(SAHeap , HEAP_GENERATE_EXCEPTIONS , LenNeeded);
GetFileSecurity( (LPCTSTR)filelist->GetNext(pos).GetString() , OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION , pSD , LenNeeded , &LenNeeded );
GetSecurityDescriptorDacl(pSD , &DaclF , &pAcl , &AclDefF);
GetAclInformation(pAcl , &ASizeInfo , sizeof(ACL_SIZE_INFORMATION) , AclSizeInformation);
for(iAce = 0 ; iAce < ASizeInfo.AceCount ; iAce++)
{
AType = GetAce(pAcl , iAce , (LPVOID*)&pAce);
if(AType == ACCESS_ALLOWED_ACE_TYPE)
AfxMessageBox("Access");
}
}
The second time when first "for" loop run unhandled error happend after this line:
GetFileSecurity( (LPCTSTR)filelist->GetNext(pos).GetString() , OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION , pSD , 0 , &LenNeeded );
and thats access violation...error.
Any idea?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
If fileList has n positions, seems to me you're trying to obtain n+1 elements: one GetHeadPosition and n GetNext s. If the list has two elements, you'll run into an error at the second iteration.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It seems that you are right.Now how can I deal with fileLlist ?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Oop,s I wasn't right, the problem is different: you're calling GetNext twice in each iteration. Do it only once, and use this reference value later:
for(...)
{
TYPE_OF_ELEMENTS_OF_FILELIST& element=filelist->GetNext(pos);
...
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yes,I was thinking whats wrong with my CSdtringList ,I've used it many times before like this but why it does not work here.Thanks Joaquín,like always.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Are you sure GetNext() returns you a value?
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Philip Patrick wrote:
Are you sure GetNext() returns you a value?
Yes,the problem is here,but I don't know the solution?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
It doesn't have any comments
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Is there a way that I can read the version info in the resource and display it in the about box?
Thanks
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Hi,
Have a look at
GetFileVersionInfoSize
GetFileVersionInfo
Regards,
Prem
|
|
|
|
|
Hi all, long time no see. I have a smallish problem that I just can't get my head round. I have installed Microsofts DirectX 7 SDK and want to start using it. I have updated the lib and include directories so they look in the appropriate places (i.e. where i installed the sdk). However, when I try to use DirectDrawCreateEx() with parameter 3 as IID_IDirectDraw7 I get two unresolved externals for the function and GUID. I've had a look at the include directory of the SDK, only header files? is that normal. Is it trying to access a lib and is failing for some reason??? why? why? why? Could someone please help or point me to a page that would help me.
Much appreciated,
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Hi all, I found the problem. For anyone who has a similar problem for unresolved externals do this:
1. Make sure you have the relevant lib and include directories (where you installed SDK) listed in Tools > Options > Directories menu (and are at top).
2. Go to Project > Settings > LINK > Object/Library Modules and add ddraw.lib and dxguid.lib. (btw. Microsoft recommends you do it this way as opposed to #include headers, honest it says on their web site in the DirectX SDK section).
You'll find the errors will magically disappear if you've done it correctly.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|