|
Hi All,
I’m doing some processing in method of view(CView) and wanted to display result in my document(CDocument). Its my first application for Doc/View Architecture. I’ve created MFC SDI Application from Project Wizard of VC++ 6.0.
Please guide me for that. Also I’d like to mention that all my document would be ASCII text ya, kind of notepad application but the content would have to be displayed from background process in code of View. I’d like if someone give me direction for implementing Copy data area from that view. No need to cut and paste.
Does this SDI provide me scrolling also when the area will exceed? IS there any change need to be done to introduce scrolling?
Thanks a lot for lot of answers
-- Sumit
Please make a CC of reply at sumit@elitecore.com
|
|
|
|
|
Hi,
You must use the method CView::GetDocument() , that get pointer to the CDocument.
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
Hey Eugene,
Thanks for your answer, But I'm not aware of how to flow. What methods are used for display? Can you provide me a summery of doing this?
Say I have some thread running on my CView::OnNew(). Now this thread returns some result. And I wanted to Display this text output, in multiple lines. I wanted to provide support to copy that text also.
Thanks for all help and appritiate lot to smart piece of code for steps and overview.
-- Sumit
|
|
|
|
|
It would be better to proccess the information in the document class, then you will have to create a pointer to the document class, extract your information in a function on the view class. Then obtain a dc to the window you would like to display your text in and use DC functions for displaying it. you will be able to create support for copying, as the information is stored in the document.
remember if u start a thread from the document class u will have to pass the thread the cview HWND handle if u want to send any windows messages from your thread, also it's not always possible to pass a thread a pointer such as ur Document class pointer, but it sometimes is!
Hope this helps in someway.
|
|
|
|
|
Hi,
It helps me, but very little. I knew that what I's doing was a little wrong way. But still I'm fix with how to achieve this. See I tell you what I wana achieve. I wanted at "OnOk" of Dialog-Box, I contact to server, get data from there and now i need to display that data. Please Help me. I've simply created and MFC EXE application and changed base class of my view to CEditView. Now in MyView::OnFileNew()I'm Calling DoModal of my dialog-box, I get server IP from there and then do processing and get data which has to be displayed.
Please suggest me some programming steps to go further. I'd be happy if someone suggest over some of my previous wrong methods also.
Thanks in advance.
-- Sumit
|
|
|
|
|
Hi,
How can i get a bitmap buffer from a .dib file?
Neha
|
|
|
|
|
Look in the code of the IconPro sample from Platform SDK. There is a file that is working with DIBs (dib.c)
Also look here in this article: DibSection
And, you can find a lot of info in "Bitmaps and Palettes" section here, on CodeProject
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Thanks for the reply.
But i feel .dib &.bmp are same in windows.
If i write
HANDLE hImage = ::LoadImage (AfxGetInstanceHandle(), "d:\\winnt\\prescan3.BMP", IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE );
I will hImage as NULL.
Why is it so?
|
|
|
|
|
Try to put NULL instead of AfxGetInstanceHandle()
This should help, cause when you are loading from file you do not need the Instance handle
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
It works with all other bmp file.But it doesn't work with the file which i renamed from .dib to .bmp.
Any idea?
|
|
|
|
|
Did you try to open the file with other utilities? Such an IrfanView, or simple Word?
And if you can, can you send me that .dib file, so I'll play with it?
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Also, look at DIBLOOK sample in your MSDN. This project supposed to open DIB files as well as BMP file. If it is not, so your .dib is corrupted
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Explanation,
I have some code that runs in a toplevel windows position,
This code never-the less appears to get infected and corrupted by virri on occasions.
So I do a couple of CRC checks on the apps initiation to verify if the existing code is also infected.
for-example:
if( code_infected() ) { Error_message(); Exit(); }
else RunTheApp();
Ok simple enough eh!
My question is how can I detect what was the malware/nasty that infected my App ?
Note all the code is in one exe.
I could spawn a process that monitors the app, but this would be liable to be infected as well.
Any help welcome ! Thanks.
Regardz
Colin J Davies
Sonork ID 100.9197:ColinI live in Bob's HungOut now
A good example of "Fully Managed" coding
|
|
|
|
|
Look for CheckSumMappedFile() in your MSDN. You'll find there all about executable files images
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
There's an unused field in the PE header that you can use to store a checksum of the file. You would use or write a checksumming program and run that on your app, and that program would store the checksum in the PE header. Then your code_infected() routine would use the same algorithm to compute the checksum and compare the two.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
What if it's a smart virii that modifies the checksum field?
Todd Smith
|
|
|
|
|
A virus that analyzes the host program, locates the checksumming algorithm, runs it against itself, and saves & verifies a new checksum? Not likely.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Well, what if the target application is a crack program. Then it would be very very easy to crack the program.
I think Colin is trying to protect an application from the crackers. If so, you should choose a third-party library. Here is a good one.http://www.bit-arts.com/ It is really expensive, but if you use ChargeKey service to sell your software, they provide these programs for free. Have a look at it.
Kind regards
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
|
|
|
|
|
I have a procedure in sybase which has to be executed
in frontend thru VC++...So, how do u go abt it...! Right now i
have used DBGrid Control to access my info in the frontend...as per my understanding...!Or is there any other way to spool the info of the stored procedure....?I just have to see the data in the stored procedure ,excuted in the front end...!
plz help
S
|
|
|
|
|
I re-worked one of my functions today and for some reason, all of the new variables that I create share the same address and, therefore, share the same data. It's causing some issues with the handling of the application and I've never seen anything like this before. Does anyone have any ideas as to how this could happen or how I could fix it?
|
|
|
|
|
Post the code here, so someone will answer more correctly.
It is something in your code, check assignments. Also are this variables pointers or not?
IS, post the code here
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Here is the code:
CString OffensiveBackfield;
if (true)
{
int ItemIndex;
CString Subheading;
CString SubheadingNumber;
bool SubheadingAdded = false;
//Populate the dialog item drop down lists with the position names
NumFormations = pApp->GetProfileInt("Offensive Backfield Formations\\Formations", "NumFormations", 0);
if (NumFormations > 0)
{
for (int j = 3; j < 6; j++)
{
for (i = 1; i <= NumFormations; i++)
{
_itoa( i, buffer, 10 );
FormationRegName = pApp->GetProfileString("Offensive Backfield Formations\\Formations", "Formation" + (CString)buffer);
NumReceivers = pApp->GetProfileInt("Offensive Backfield Formations\\Formations", "WR" + (CString)buffer, 0);
if (NumReceivers == j)
{
if (!SubheadingAdded)
{
_itoa(j, SubheadingNumber.GetBuffer(0), 10);
strcat(SubheadingNumber.GetBuffer(0), " Wide Receivers");
Subheading = SubheadingNumber;
ItemIndex = pOffensiveBackfieldBox->AddString(Subheading);
pOffensiveBackfieldBox->SetItemData(ItemIndex, 0);
SubheadingAdded = true;
}
TildeCheck = FormationRegName.Find(" ~ ");
if (TildeCheck != -1)
{
FormationName = FormationRegName.Left(TildeCheck);
}
else
{
FormationName = FormationRegName;
}
ItemIndex = pOffensiveBackfieldBox->AddString(FormationName);
pOffensiveBackfieldBox->SetItemData(ItemIndex, 1);
}
}
SubheadingAdded = false;
}
}
}
if(OffensiveBackfield != "")
{
pOffensiveBackfieldBox->SelectString(0, OffensiveBackfield);
}
For some reason, the variables "Subheading", "SubheadingNumber", and "OffensiveBackfield" all have the same address associated with them. After the line "_itoa(j, SubheadingNumber.GetBuffer(0), 10);", all three of the variables have the same data in them. This is not how it should be and I'm wondering how this is happening.
|
|
|
|
|
Stew wrote:
_itoa(j, SubheadingNumber.GetBuffer(0), 10);
strcat(SubheadingNumber.GetBuffer(0), " Wide Receivers");
You have two problems there. First, you're allocating a buffer of length 0, so the _itoa() and strcat() calls are overrunning the buffer. Second, you're not calling ReleaseBuffer(). Do something like:
LPTSTR pszBuff = SubheadingNumber.GetBuffer(16);
_itoa ( j, pszBuff, 10 );
SubheadingNumber.ReleaseBuffer();
SubheadingNumber += _T(" Wide Receivers");
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Oh, I'm late, LMAO, Well, Michael told ya already
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Can someone help me with a demo project? I have two (2) edit boxes. When I type something in one edit box I want the other edit box to instantaneously update. However, if I keep typing information, new information is typed on top of old information. It looks awful. I tried
m_edit0 = name;
GetDlgItem(IDC_EDIT0)->Invalidate();
GetDlgItem(IDC_EDIT0)->UpdateWindow();
and alot of other things, but nothing makes it work correctly. Please, please, can I email a demo project that illustrates this error and hopefully, someone will be able to help me fix it?
My email address is brinasas@yahoo.com
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|