|
Hi.
I have a View in which user can draw vectors. Each vector can be selected,( highlighted).
I also have a modeless dialog which has a ListBox each line represents a vector in the
View.
I need to do: when I select a line in the ListBox which is in Dialog my program will also
highlight an appropriate vector.
In a nut shell:
I don't know how to send to a View a message that line in the list box was highlighted,
so it will highlight the appropriate vectors.
thanks ahead.
bye.
|
|
|
|
|
To get the view from anywhere
CFrameWnd *pFrameWnd = (CFrameWnd *)AfxGetMainWnd();
ASSERT (pFrameWnd != NULL && pFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd))); // or CFrameWnd if SDI
pFrameWnd = ((CMDIFrameWnd *)pFrameWnd)->GetActiveFrame(); // or CFrameWnd if SDI
CMyView * pView = (CMyView*)pFrameWnd->GetActiveView();
CMyDoc * pDoc = (CMyDoc*)pFrameWnd->GetActiveDocument();
Then it's a case of writing a function that takes the info and updates the display, and calling it. In fact, the above code is through all the dialog boxes in my paint program for exactly the same sort of thing you are describing.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I wanted to know how software like GetRight and Gozzila can do to intercept the http or ftp connections in internet explorer or netscape right when the user click on it?
Crocmort
|
|
|
|
|
For I.E I think they are using an IEHelper Object
When an instance of Internet Explorer is started, it looks in the registry for CLSIDs stored under the following key:
HKLM\SOFTWARE\Microsoft\Windows \CurrentVersion\Explorer\Browser Helper Objects
If this key exists and there are CLSIDs listed under it, Internet Explorer will use CoCreateInstance() to try to create an instance of each object listed as a subkey under this key. Note that the CLSID of the object you create must be listed as a subkey and not a named value.
There are some requirements when creating a Browser Helper Object
1 The application that you create must be an in-proc server (that is, DLL).
2 This DLL must implement IObjectWithSite.
3 The IObjectWithSite::SetSite() method must be implemented
Also It is possible to connect to a running instance of Internet Explorer version 4.0 or later using the SHDocVw.ShellWindows collection.
Regards
Alfadhly
<marquee>
It is Illogical to define an inventor by his invention
|
|
|
|
|
I am using the CBitmapDC class to assemble bitmap files into a larger one to print in OnPrint.
Print preview shows the picture ok, but the page is blank (not much of a preview if you ask me). I understand that this is due to CBitmap being a DDB, and I need to convert it to a DIB before printing.
This has me very confused with all the different sample code and classes. It appears to me that I AM using a DIB when I load the BMP (according to docs, BMPs are in DIB format). Somehow, a CBitmap is not the same thing?
Any help getting a CBitmap to print on the printerDC (hDC, whatever) would be beneficial to my sanity.
Rick
|
|
|
|
|
a CBitmap holds a DDB. the DIB that makes up the BMP is converted to DDB when you call LoadBitmap (probably by an internal call to SetDIBits).
one thing to check: does your printer support BitBlt? if not, you'll probably have to use StretchDIBits. see GetDeviceCaps to check your printer's capabilities.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
A DIB is a device independant bitmap. The thing that holds it in this form is a DIBSection. A DDB is a CBitmap - device dependant, the device being whatever DC the CBitmap is compatible with. I use a DIBSection wrapper ( Chris just updated his on the site ) and stretchblt to perform our printing. BitBlt is essentially worthless, as the average print DC is about 6000 x 4000 for an A4 page ;0)The print preview is working because the image is compatible with the DC you are drawing to ( the screen ). So it seems your printing code is in order, you just need to load the image as a DIBSection.
If you load the bitmap using LoadImage, you can ask it to return a DIBSection, it's one of the flags. A DIBSection is a DIB that can be selected into DC's, drawn on, etc.
I apologise for the early morning ramble nature of this post, I was here until midnight last night ( finishing off our printing code ).
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hey all. This is a simple question.
I have an array I want to iterate. Its in a for loop, and each item of a 3-Dimensional array needs to be assigned a string from an input file. Unfortunately, I keep getting errors when trying to put a string in an array index. I use this line:
inFile.get(ID[i][0], 7, '|');
ID is the array and i is the for loop index. Here's the error:
error C2664: 'class istream &__thiscall istream::get(char *,int,char)' : cannot convert parameter 1 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
I've looked up the error and read everything from arrays to pointers to indexing to mountain goats and can't find the right way to do this. I'd appreciate any help. Thanks.
-Tony
|
|
|
|
|
The error says you're passing a char where a char* is expected. So something's amiss with the expression "ID[i][0]". It looks like your declaration or usage of the ID array is wrong. It's a 2D array of chars, not 3D, since 2 dereferences result in a char.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
Hi,
I have been told that I can create a windows 2000/nt service which will allow my to communicate with the user via dialog boxes.
How can I get the driver to make the service display a dialog and how does the driver retrieve what the user enters?
thanks
|
|
|
|
|
You *can* do that if you check the "Allow service to interact with desktop" in the services settings...
But I would not recomend that, services is not made to be GUI apps. Why not make a GUI-thing that talks with the server, using Named Pipes, Sockets or something else...
How can I get the driver to make the service display a dialog
What driver?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi!
I would like to have a small strip on the left in my SDI app. The strip should go all the way from the titlebar down to the window limits. How can I make the menus and toolbars move with respect to this strip, preferably implemented as a CView-derived object. Anyone who knows an example or something?
|
|
|
|
|
Hi,
I would like to be able to read the tag format that WMA files uses to store information about the particular track. It works a little like ID3 but of course it is slightly different. It looks like the data is stored towards the beginning of the file rather than the end.
There are functions in the windows media SDK to do it but this involves linking in to a pretty big library for what is a simple operation.
Does anyone know how to do this simply?
James
James
|
|
|
|
|
If it's just text like ID3, then the different fields are at specific locations, so open the file, read the bit required and parse it into it's relative bits.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
hello, i would like to know how can i retrieve information inside a listctrl when the item has been selected by a checkboxes in a table,
Thanks in advance
Mag
|
|
|
|
|
I have a dialog based app and I have to handle WM_CHAR messages in it. The problem is, these messages get sent to the buttons and not the CDialog object.
How can I redirect?
Thank You
LP
|
|
|
|
|
Override PreTranslateMessage in your dialog class.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
|
|
I know, PreTranslateMessage.
But, What do you mean ?
You mean, i can use WM_CHAR message in PreTranslateMessage ???
Or no ? use PreTranslateMessage itself ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have created a number of Active X controls useing MFC and I have tested them in the Active X control Container and they work fine - but when i try to get them to work in IE they don't seem to work.
Does anyone have any examples of what needs to be done to get the active x control to work in IE?
thanks
|
|
|
|
|
What do you mean they don't work? They don't load? IE shows an error message? IE formats your hard drive?
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
I'm working with really simply stuff, I'm just following a text bok word for word mouse click for mouse click, and it works exatcly fine in Active X control container. but I've tried to get them to work in IE but they won't
what happens in IE is -
the box where the control should be is shown with a picture symbol
then the page is loading
then the control just stops with out displaying anything and a red x symbol is shown
I'm placed an AfxMessgaeBox call in the InitInstance function and it gets called! in IE. but the OnDraw methode doesn't seem to be called before it stops.
Does any one a simple control that is useing MFC and works in IE. I even just run the Active X wizard in VC++ 6.0 and complied. ran fine in Active X control Container but same result in IE. Please help? I'm totally stuck.
|
|
|
|
|
I have placed TVINSERTSTRUCT as a memeber in a self-defined struct, as follows:
struct MyStruct
{
int data;
TVINSERTSTRUCT tvins;
// etc...
}
When the user clicks on button A, and having selected a particular tree item, i want to amend the value of the member 'data' which is in the same struct as the selected tree item.
I tried to use GetSelectedItem(), bt it returns a HTREEITEM. How do i know which node doe sit belong too?
Thanks in advance.
|
|
|
|
|
I think you are thinking about it backwards. It is probably easier to add your data to the TreeView items. You can accomplist this by using the lParam in the TVITEM. Whenever an item is selected, handle the TVN_SELCHANGED message for your treeview and retrieve the data and modify accordingly.
Mike
Some Code follows:
HTREEITEM tvAddItem( HTREEITEM hParent, LPSTR szText,
HTREEITEM hInsAfter, int iImage,
LPVOID pvData ) // pvData would just be your MyStruct *
{
HTREEITEM hItem;
TVITEM tvI = {0};
TVINSERTSTRUCT tvIns = {0};
// The pszText, iImage, and iSelectedImage members are filled out.
// make sure we set the flag for TVIF_PARAM
if( iImage == -1 )
{
tvI.mask = TVIF_TEXT | TVIF_PARAM;
}
else
{
tvI.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
}
tvI.pszText = szText;
tvI.cchTextMax = lstrlen (szText);
tvI.iImage = iImage;
tvI.iSelectedImage = iImage;
tvI.lParam = (LPARAM) pvData;
tvIns.item = tvI;
tvIns.hInsertAfter = hInsAfter;
tvIns.hParent = hParent;
// Insert the item into the tree.
hItem = TreeView_InsertItem( iv_ctlTreeView.m_hWnd, &tvIns );
return( hItem );
}
// update the data from the TreeView in the SELCHANGED event
// selchange WM_NOTIFY, TVN_SELCHANGED
LPNMTREEVIEW pnTree = (LPNMTREEVIEW) lParam;
MyStruct *pMyStruct;
pMyStruct = (MyStruct *) pnTree->itemNew.lParam;
|
|
|
|