|
WhiteSky wrote: I think hes a student
Me too...but it was much more fun imagining it as an employment interview test
|
|
|
|
|
...And also I dont think these questions for interview why?because employment question are technical,right?
if Prinky is student I hope Prinky learns c++ early.
but I think its difficult to learning c++ in a short time
|
|
|
|
|
WhiteSky wrote: ...I think its difficult to learning c++ in a short time
I agree!
"I have to write a code in C++ which takes an input text file from the hard disk of the
following format:
D FP CDT0 "0 :400000000000:499999999999:12,13,14,15,16,17,19:10:ABCD:2:1:11101101[ab61]"
It should first check the 3rd value in each line i.e. CDT0, store it in a variable and then
read the rest of the line which is : delimited. it should store these values in some array
(or watever the best way to do this). Basically these values have to be copied then in the
MS access DB tables. The third value of each line shows which DB table it corresponds to."
That's quite a project for a beginner. I think WalderMort summed it up best:
"Only 2 or 3 days? You had better get busy then. good luck!"
|
|
|
|
|
But In fact its four projects.Write to access we can set many detaily for it,read of file,for save same values he has many options I guess CStringArray is easy for Prinky
|
|
|
|
|
Problem Description
My project (Testing) is CFormView based SDI application. On the form view, there is a CEdit control (IDC_EDIT_ExampleText). It is used to display the full path of a selected file. Sometimes, a long path may go beyond the boundary of the CEdit control.
So, I would like to use a Tool tip to display the long path.
I implemented the tool tip functionality for the CEdit control by the following steps. However,
two tip windows poped up one after the other containing the same contents whenever I moved the cursor on to the CEdit control.
another question is when I change
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, SetTipText)
to
ON_NOTIFY_EX(TTN_NEEDTEXT, IDC_EDIT_ExampleText, SetTipText)
the tool tip does not pop up any more. Why, it should be '0'.
--------- Steps --------------
Step 1: declare a CToolTipCtrl member variable for CTestingView
CToolTipCtrl *m_ToolTip
Step 2:
in the OnInitialUpdate(), add the following lines
<br />
EnableToolTips(TRUE); <br />
m_ToolTip= new CToolTipCtrl();<br />
m_ToolTip->Create(this);<br />
<br />
m_ToolTip->AddTool(&m_EDIT_ExampleText, LPSTR_TEXTCALLBACK);<br />
m_ToolTip->Activate(TRUE);<br />
<br />
Step 3:
Overload the function PreTranslateMessage by adding a new member function PreTranslateMessage(MSG* pMsg) to CTestingView
<br />
<br />
BOOL CTestingView::PreTranslateMessage(MSG* pMsg)<br />
{<br />
if(m_ToolTip != NULL)<br />
m_ToolTip->RelayEvent(pMsg);<br />
<br />
return CFormView::PreTranslateMessage(pMsg);<br />
<br />
<br />
}<br />
Step 4:
Add messae mapping
<br />
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, SetTipText)<br />
<br />
Step 5:
Add new member function SetTipText(UINT id, NMHDR *pTTTStruct, LRESULT *pResult) to CTestingView
<br />
BOOL CTestingView::SetTipText(UINT id, NMHDR *pTTTStruct, LRESULT *pResult)<br />
{<br />
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pTTTStruct;<br />
UINT nID = pTTTStruct->idFrom;<br />
nID = ::GetDlgCtrlID((HWND)nID);<br />
char * Content_m_EDIT_ExampleText;<br />
Content_m_EDIT_ExampleText = (char *)malloc(sizeof(char) * (m_EDIT_ExampleText.LineLength() + 2) );<br />
m_EDIT_ExampleText.GetLine(0, Content_m_EDIT_ExampleText);<br />
strcpy(pTTT->lpszText, "ooppp");
<br />
<br />
<br />
return (FALSE);<br />
}<br />
<br />
|
|
|
|
|
cy163@hotmail.com wrote: another question is when I change
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, SetTipText)
to
ON_NOTIFY_EX(TTN_NEEDTEXT, IDC_EDIT_ExampleText, SetTipText)
the tool tip does not pop up any more. Why, it should be '0'.
Without a control with ID==0 you will no longer get the message.
Anyway, do you need to create a CToolTipCtrl? That may be why it's showing two tooltips.
Try just calling EnableToolTips(TRUE); and handling ON_NOTIFY_EX(TTN_NEEDTEXT, IDC_EDIT_ExampleText, SetTipText)
like you were.
|
|
|
|
|
As part of enabling tool tips, you handle the TTN_NEEDTEXT message by adding the following entry to your owner window’s message map:
ON_NOTIFY_EX( TTN_NEEDTEXT, 0, memberFxn )
memberFxn
The member function to be called when text is needed for this button.
Note that the ID of a tool tip is always 0.
The information was from MSDN.
|
|
|
|
|
Good people,
I am trying to place a Banner across the top portion of my dialogue. I am using a bitmap I created. I create the bitmap with the dimensions of the picture control that I place on the dialogue. My goal is that it will run across the top part - giving the application a nice look and feel. However, I have been unable to get it to size correctly. Even though I use the exact dimensions (in pixels) of the picture control, when I compile and run it, the size is always smaller (and sometimes larger) than the area it needs to cover on the dialogue.
How can I get it to display correctly (and possibly even shrink or grow as the dialogue is adjusted)? Any help or thoughts would be greatly appreciated. BTW, I am using VS 2003 .NET. I am building MFC Dialogues.
|
|
|
|
|
How are you getting the size of the picture control?
To resize a bitmap just blit it to the picture controls DC using StretchBlit() .
|
|
|
|
|
How do you use that function?
|
|
|
|
|
Can you show code snippet how do you use
|
|
|
|
|
Thanks for replying.
I am not using any code except the one automatically generated when you place a picture control on a dialogue and assign a bitmap.
To see the effect I'm trying to get...look at this screenshot http://sourceforge.net/project/screenshots.php?group_id=95013&ssid=18186 of a KeePass dialogue, notice how that banner is across the top of his dialogues. Any idea about how to do that?
Thanks,
BP
|
|
|
|
|
yes I see,you can use of StretchBlit for show your image but for get dimensions of window you can use of GetWindowRect <screentoclient< code=""> now you have left/right/top/bottom of window and you can use of their on StretchBlit
|
|
|
|
|
Hi to all,
I am new to Visual Studios 2003, i want to develop an application in VC++.net, so i have to work through the template Managed C++ Application Template.
But my Visual Studios 2003 doesn't have those Three Template available.
Can any one help me in this regard, i have to work on those template.
Do i have to install them separately or do i have to check any options???
Plz help me.
Thanks in Advance.
With Regards, Gopinath MV
|
|
|
|
|
Friends,
I have an edit control on a dialog box. I've placed some text in the edit box during dialog initialization. The problem is that, when the dialog appears on the screen, the entire text in the edit box is *selected*. I want to remove this selection, however i want the focus to remain in the edit control. I am doing something as follows but it is not working:
BOOL CWebServiceURLDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_editUrl.SetWindowText(_T("Tomato"));
m_editUrl.SetSel(-1, 0);
return TRUE;
}
Please tell me how to remove the selection.
Imtiaz
|
|
|
|
|
Imtiaz Murtaza wrote: m_editUrl.SetSel(-1, 0);
Try this
m_editUrl.SetSel( -1, 0, 0 );
|
|
|
|
|
Not working at all
Imtiaz
|
|
|
|
|
That's because your selection is being cancelled by what OnInitDialog() is doing when it finishes. You need to call PostMessage() instead, and in the handler for the message, call SetSel() . That will work.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Imtiaz Murtaza wrote: return TRUE;
You should return FALSE , if you want to set focus to a control in a dialog, from OnInitDialog .
As far as the selection issue is concerned I don't see any problem here. It's working here.
|
|
|
|
|
Hi,everyone. My application is based on Muti-Doc (VC6.0).
I created a controlbar in mainfrm (OnCreate()) and then created a tabcontrol in the controlbar (also in OnCreate()), then I created a TreeCtrl in the TabCtrl.
HTREEITEM hti1 = m_wndTree1.InsertItem(_T("Chapter1"));
HTREEITEM subroot1=m_wndTree1.InsertItem("section1",hti);
HTREEITEM hti2 = m_wndTree1.InsertItem(_T("Chapter2"));
Now I want to add "Chapter3" in the TreeCtrl by menu, what should I do???
If you can show some codes , that's better. Because I'm a begginner.
Thanks a lot.
|
|
|
|
|
wangpai wrote: HTREEITEM hti2 = m_wndTree1.InsertItem(_T("Chapter2"));
Um...
HTREEITEM hti3 = m_wndTree1.InsertItem(_T("Chapter3"));
seems obvious to me....
If you want a menu to add the item, then you need to put that code into the method called by a menu item.
|
|
|
|
|
I created the treectrl in mainfrm.cpp, and used ID_FILE_NEW_ADD menu item to do this work.
I add this to my codes:
void CMainFrame::OnFileNewAdd()
{
// TODO: Add your command handler code here
HTREEITEM hti3 = m_wndTree1.InsertItem(_T("Chapter3"));
}
But it didn't work.
|
|
|
|
|
Which didn't work InsertItem or event of ID_FILE_NEW_ADD
|
|
|
|
|
Ok, there is something I really don't get. I'm triing to use the function _strnset_s, but I get the compiler error : '_strnset_s': identifier not found, even with argument-dependent lookup.
The thing is that string.h is included in my project and at the line just before this one, I used strrchr wich need the same include and the compiler doesn't complain about this one. What did I do wrong?
here a very short version of my code:
stdafx.h :
#pragma once
#define WIN32_LEAN_AND_MEAN
headers
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
// Others
#include <stdio.h>
#include <string.h>
#include <afx.h>
Form1.cpp :
#include "stdafx.h"
#include "Form1.h"
Form1.h :
#pragma once
#pragma push_macro("GetObject")
#undef GetObject
#pragma push_macro("MessageBox")
#undef MessageBox
namespace VampireReader
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Runtime::InteropServices;
using namespace System::Text;
private:
System::ComponentModel::Container * components;
void InitializeComponent(void)...
private: void fOpenFile()
{
csDest = strrchr( csFName, '\\' );
_strnset_s( csDest, sizeof(csDest), ' ', 1 );
}
|
|
|
|
|
Maybe you are pointing to a string.h from a previous sdk.
Right click on the include, open string.h, and search for "_strnset_s".
If it's not there you need an SDK update.
|
|
|
|