|
Hi,
I am a newbiew to .NET, MFC and Visual C++.
I have multiple Views (Say View A, B and C), and a Document in my Design. On the Print and Print Preview I need to print information from all the views. Currently I have overloaded the OnPrint() function in View A.
After View A 's print is done, how do I get it to Print View B and View C's Data. Should I post a Message to View B and C passing the CDC object, and each of the View (B &C) use the CDC object and continue the printing.
Please let me know if thats the right way to do or if there is a better way. Also how do I print across pages.
Thanks for your help.
|
|
|
|
|
Certainly you could pass a message with CDC as parameter - or create custom class to do printing and from the OnPrint method in one of the views create an array of pointers to all other views and pass this as a parameter to your print method that would then print all of them.
As per printing accross pages - done it few times and always a headache. One of the better techniques I used was clipping rectangles (per page) and moving CDC drawing origin according to the page being printed. I think this worked the best for me.
Good luck
Regards
JP
|
|
|
|
|
Hi All,
I have been trying to do this simple task for half a night and as simple as it sounds, I can't get it to work.
I have a listview and I am trying to get the text of the selected item when user selects one (this is a single select listview). I've tried the following but none work:
System::Void Form1::lv_files_SelectedIndexChanged(System::Object * sender, System::EventArgs * e){
String* sss = lv_files->SelectedItems->Item(0)->Text;
ListViewItem* selectedFile = dynamic_cast<ListViewItem*>(e);
String* sss = selectedFile->Text;
}
So how do I actually get the text of the selected item? Im tired, and passed the pissed off point so any help would be appreciated immensly
TraileR ParK LifE 4Ever >:{
|
|
|
|
|
|
It worked! Thanks a lot!
...And I've been trying all those complicated ways when this short line does it!
Thanks again
TraileR ParK LifE 4Ever >:{
|
|
|
|
|
gr8coaster329 wrote:
...And I've been trying all those complicated ways when this short line does it!
Exactly my feelings whenever I see James Bond seducing yet another Bond girl.
gr8coaster329 wrote:
Thanks again
No problem. Glad to be of help
--
"the name's Lamas, Jose Lamas" jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
lv_files->SelectedItems[0]->Text
Hi - I'm having this same issue. When I try the solution above, I get
error C2227: left of '->Text' must point to class/struct/union
(The intellisense also warns me that it won't work.)
My code is:
String* test = listView_Main->SelectedItems[0]->Text;
Any suggestions?
Thank you,
--Jordan
|
|
|
|
|
Hi
My program suppose to be sometimes hidden. when the user wants to show it, its button in the taskbar does not have the correct status. that means that if the program was first maximized (before hiding it) it is being shown maximized too but the minimize button (on the window corner) does not work and right click on its taskbar button shows only the maximize button.
Here is the code when hiding the window:
<br />
::GetWindowPlacement(hWnd,&sWndPlt);<br />
::ShowWindow(hWnd,SW_HIDE);<br />
And here is the code when Showing the window:
<br />
::SetWindowPlacement(hWnd,&sWndPlt);<br />
::ShowWindow(hWnd,SW_SHOW);<br />
::UpdateWindow(hWnd);<br />
::SetForegroundWindow(hWnd);<br />
::SetActiveWindow(hWnd);<br />
Is there a way to solve this problem?
Thanks a lot
mamtz
|
|
|
|
|
Is your MinimizeBox property of your form set to False?
TraileR ParK LifE 4Ever >:{
|
|
|
|
|
I forgot to mention that actually i have 2 programes. The first is always hidden and the second suppose to be sometimes hidden and sometimes not. The first one register the hot keys and is the one which hidding the second one.
The first program has no maximize/minimize/system menu.
The second program has these buttons and they are enabled.
Does it make things different?
|
|
|
|
|
how can i hide the taskbar while my program is running and then unhide it when the program closes.
- Kyle
|
|
|
|
|
Why would you want to do this? You should *never* change a user's preferences just to suit your program.
|
|
|
|
|
i want to do this because the taskbar cuts off the bottom of the window.
is there a way to fit the window to the screen?
- Kyle
|
|
|
|
|
If you maximize the window, it will fill the screen, excluding the taskbar. Is that not what you want to do?
|
|
|
|
|
yes that is what i wanted to do thank you i will try it
- Kyle
|
|
|
|
|
Hi Kyle
I didn't try it but i think it will work:
1. get the taskbar window handler:
<br />
HWND wDesk=GetDesktopWindow();<br />
HWND wTray=FindWindowEx(wDesk,NULL,"Shell_TrayWnd", "");<br />
2. hide it:
<br />
ShowWindow(wTray,SW_HIDE);<br />
3. show it back again:
<br />
ShowWindow(wTray,SW_SHOW);<br />
Good luck
Mamtz
|
|
|
|
|
i made a program which searches other windowsfor other aps, and gets stuff like the content of text boxes , clicks buttons etc..
the program is a poker program, and when your two cards show up, the program gets two images from a dirctory representing the cards. Because i need to know the 2 cards which i have, i was wondering whether there was any chance of being able to tell which images are put into the gui.
i have had alook at some other child windows apart from the edit controls and combo boxes etc, and i have seen many ones which are called 'static', and others which are named 'afx...' (i think the latter are something to do with mfc?
are the static ones likely to be images? If so, is there any way i can tell what images they are?
if i cannot do it through looking at the gui, do you think there is a way to do this by listening to the folder that the images are in? or would this not work because they are all put into memory maybe when the app starts..
Thankyou.
|
|
|
|
|
I created a file DLL by VC++. After that to insert in VisualBasic I do following:
From Menu choose Project->Reference...-> Browse to file *.DLL (Adsoft.DLL)
Choose in ComboList (Prọect/Library)->Adsoft
But any class and function in there don't to appear.
If possible. Can you give me an example ?
I write this class following:
//VC++
// Adsoft.H
#ifdef ADSOFT_IMPL
#define CLASS_DECL_ADSOFT _declspec(dllexport)
#else
#define CLASS_DECL_ADSOFT _declspec(dllimport)
#endif
#undef AFX_DATA
#define AFX_DATA CLASS_DECL_ADSOFT
class AdsoftDLL : public CSocket
{
public:
BOOL CGetCheckErro(int nErroCode);
};
#undef AFX_DATA
#define AFX_DATA
// Adsoft.cpp
#include "afxdllx.h"
#include "Adsoft.h"
BOOL CGetCheckErro(int nErroCode)
{
if (nErroCode==0)
return FALSE;
return TRUE;
}
But to happen phenomenon don't to want
Thanks!
|
|
|
|
|
U will need to include/import that reference in your VB file. I believe for VB it will look something like this:
Imports Adsoft
TraileR ParK LifE 4Ever >:{
|
|
|
|
|
I am not sure what forum this question belongs to.
Could anyone make an educated guess about how bcwipe and other such companies swap file wiping works?
Is there any such open source utility that claims to do this?
I could not find such a thing.
I am guessing that they allocated huge amounts of memory that they hope the system will write to the page file (overwriting whatever was there before).
Any lead,code,educated guess will be very helpfull.
|
|
|
|
|
If I have an array of n records. Which of them will be fast according to operations for traversing all records. ? Will it be equal or array or is dependent on architecture ?
|
|
|
|
|
|
|
Anonymous wrote:
If I have an array of n records. Which of them will be fast according to operations for traversing all records.
I believe MAP are much Faster!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
It is interesting that he suggested 'traverse' without specifying a constraint.
Because if he merely requires ITERATION in inserted order, how can anything be faster than 'traversing' an array? No additional pointer access or lookup required, as long as records are all of same size. Just set a pointer to beginning of array and increement it by sizeof record to get next element. Not even a list is faster than that, right? Unless pointer assignment is faster than addition ...
You have
pCurrent = pCurrent + sizeof(record)
or else
pCurrent = pCurrent->Next
A map involves much more effort, but can give you potentaily sorted items, grouped items, or a lookup by keyed items.
|
|
|
|