|
Thanks for the input.
To answer your question I had assigned developers to try to convert the application to VC++ 2003. Since the applications is over ten years old it has seen its share of GUI toolkits and some of these toolkits are not converting to the new platform. So one of my goals is to slowly move the application to the new platform. I am trying to make the application co-exist between VC ++ 6 (old code) and VC++ (maybe .net) 2003 or greater (new code). Since I don't have the option to compile the application greater than VC++ 6.
Thanks,
-e
|
|
|
|
|
MSVS is actually a studio and not specificaly intended for only C++. You are able to compile most languages using MSVS including C#, J#, C++, C. Maybe you meant to say MSVC?
It is possible to call C# code from C++. Usually the C# would be in the form of a dll, and you would need to manually register the type library. Also the .NET runtimes would need to be installed on the client machine. The process of doing this is a little complicated, but there are some articles here on CP which demonstrate it.
|
|
|
|
|
Thanks for replying,
I should of been more specific with the development language. The existing application is coded using VC++ 6 (MFC). At the moment I can't covert (promote) the existing code to a greater platform than VC++ 6 (for various reasons). So I am looking for a way to have new development be written in VC++ 2003(or higher) or C# and try to co-exist with the existing code. So I guess what I'm looking for is an application that is compiled with VC++ (MFC) 6 to have mixed code; the existing code to use MFC 6 components (like dialogs etc..) and the new code to use C#, VC++ 7 code (like Win-Forms etc...).
Thanks,
-e
P.S. My goal is to eventually move the application to the newer platform (in baby steps).
|
|
|
|
|
I've done this via Com Callable Wrappers (CCW) around .NET components.
This[^] article is a good starting point.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Do you know a class like CScrollWindow, which I can use to scroll window view, but I don't want to use the document/view architecture?
Regards
mwgomez
|
|
|
|
|
As i know, no suvh class.
acturally u do'nt need to find it, scroll is easy to do:
1.add scroll-bars if neccessary.
2.show/hide and manage scrolling by a little bit code.
//follwings are my code for your reference
//bar_Vert and bar_Horz are added on a prperty-page
void SheetPreviewPgGragh::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CPropertyPage::OnVScroll(nSBCode, nPos, pScrollBar);
if(pScrollBar!=&bar_Vert) return;
P_ScrollBar(nSBCode,nPos,pScrollBar);
}
void SheetPreviewPgGragh::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CPropertyPage::OnHScroll(nSBCode, nPos, pScrollBar);
if(pScrollBar!=&bar_Horz) return;
P_ScrollBar(nSBCode,nPos,pScrollBar);
}
void SheetPreviewPgGragh::P_ScrollBar(int iCode, int iPosIn,CScrollBar*pBar)
{
SCROLLINFO si;
si.cbSize =sizeof(SCROLLINFO);
si.fMask=SIF_ALL;
pBar->GetScrollInfo(&si);
int iPos =si.nPos;
switch(iCode)
{
case SB_LINEUP:
iPos-=1;
break;
case SB_LINEDOWN:
iPos+=1;
break;
case SB_PAGEUP:
iPos-=si.nPage;
break;
case SB_PAGEDOWN:
iPos+=si.nPage;
break;
case SB_THUMBTRACK:
iPos=iPosIn;
break;
}
if(iPos<0) iPos=0;
if(iPos>(int)(si.nMax-si.nPage)) iPos=si.nMax-si.nPage+1;
if(iPos==si.nPos) return;
si.nPos=iPos;
pBar->SetScrollInfo(&si);
RedrawPage();
}
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
How to output an array of datatype CString and of size[2400]in a Listbox control????
|
|
|
|
|
CString array[2400];
CListBox listbox;
for (int i = 0; i < 2400; i++) {
listbox.AddString(array[i]);
}
Software Zen: delete this;
|
|
|
|
|
Ya thank you very much for ur reply, whatever you have written is correct and i was owrking int he same way, but i was encountering an error while using with two dimensional arrays.How could i use for two dimensional arrays?
CString average[100][100];
CListBox m_stravevalues;
for(i=0;i<60;i++)
for(j=0;j<40;j++)
{
m_stravevalues.AddString(average[i][j]);
}
Is this correct???
|
|
|
|
|
Not Correct, A Listbox is One Dimensional, and cannot display 2 Dimensions. Maybe you're looking for a Multi Colum listbox??
LateNightsInNewry
|
|
|
|
|
So, anybody could help me, to output this two dimensional array in a List box or Edit box.
|
|
|
|
|
Hi again
i'm in trouble again with strings.
What i want to do is read from a file, line by line (each line has only one word)
and compare it with onother string. the problem is that the way i do it is the following
void Html_Parser::dictionary(string tokencheck)
{
FILE *dFile;
bool found=false;
char string_token[50];
dFile = fopen("dictionary.txt","r");
if (dFile == NULL)
perror ("Error opening file");
else
{
do
{
fgets (string_token , 50 , dFile);
puts (string_token);
if (strcmp (string_token,tokencheck) == 0)//incompatible
{
found=true;
cout<<"found"<
|
|
|
|
|
Don't use all this old fashioned fopen and fgets - This is C++ not C!
Here's how I'd do it. I haven't tested this, it's off the cuff; so you may need to add a semicolon or some such:
void TokenCheck(const string &token)
{
ifstream fs("dictionary.txt");
if ( fs )
{
istream_iterator<string> i(fs);
istream_iterator<string> e;
if ( find(i, e, token)!=e )
{
}
}
}</code>
Uses the following includes:
<string>
<fstream>
<iterator>
<algorithm>
Assumes:
using namespace std;
Steve
|
|
|
|
|
Hey Steve thanks a lot appresiate the help.
can u tell me a good c++ library reference site so i can stop using those old fashion functions thanks again
|
|
|
|
|
I'm not sure about a site - I've got a book on C++ and one on The Standard Library.
Steve
|
|
|
|
|
|
Or just this:
if (string_token==tokencheck)
This is potentially more efficient because c_str() may allocate a buffer to store the string on some implementations - It is not mandatory for a basic_string to store the string in one chunk of contiguous memory: some use a collection chunks, for example. On such implementations calling c_str() may not be as "cheap" as one may expect.
The following operators are defined in <string> which allow the above usage:
template<class CharType, class Traits, class Allocator>
bool operator==(
const basic_string<CharType, Traits, Allocator>& _Left,
const CharType *_Right
);
template<class CharType, class Traits, class Allocator>
bool operator==(
const CharType *_Left,
const basic_string<CharType, Traits, Allocator>& _Right
);
Steve
|
|
|
|
|
Hi,
I want to put a semi-transparent bitmap into my dialog, and I've the following code:
BLENDFUNCTION bf;
bf.AlphaFormat = 0;
bf.BlendFlags = 0;
bf.BlendOp = AC_SRC_OVER;
bf.SourceConstantAlpha = 0x7f;
CRect rect;
GetDlgItem(IDC_PRUEBA_TRANS)->GetWindowRect(&rect);
CClientDC dc(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
AlphaBlend(GetDlgItem(IDC_PRUEBA_TRANS)->GetDC()->GetSafeHdc(), 0, 0, rect.Width(), rect.Height(), dc, 0, 0, rect.Width(), rect.Height(), bf);
This code purpose was to test if AlphaBlend is working all-right with my dialog, and it seem that it does.
Now my problem is: I've bitmaps as "BITMAPS" in my resource file. IDC_PRUEBA_TRANS is a CStatic Ctrl with Bitmap enabled and a Bitmap loaded through designer (not code). If I do such:
AlphaBlend(dc, 0, 0, rect.Width(), rect.Height(), dcMem, 0, 0, rect.Width(), rect.Height(), bf);
The transparent bitmap will be drawn on the opaque one, so the transparency will not be visible (for that reason, I tried to put a form shot into IDC_PRUEBA_TRANS, to test it).
So I'd like to know how can I get a CDC from a CBitmap or whatever way of do this thing...
Thank you,
Rafael Fernández López.
|
|
|
|
|
Just off the top of my head, but do not set the static control to load the bitmap. If you can draw the bitmap your self, then you already know that it will fit (or can be made to fit) within the static controls rectangular client area. Set the static control to just provide the rectangular area where the drawing will occur, basicaly a place holder.
INTP
Every thing is relative...
|
|
|
|
|
Hi, i have a property sheet which is tabbed and the tabs are stacked
there are 6 tabs which strech across two lines,
however when the property sheet is first called, the lower line of tabs seem to be
hidden, they only appear when i have clicked onto another tab
i have posted an image of what i mean, as its hard to explain [^]
Pages are added like
BOOL CTabSettings::OnInitDialog()
{
CDialog::OnInitDialog();
m_sheet.AddPage(&m_page0);
m_sheet.AddPage(&m_page1);
m_sheet.AddPage(&m_page2);
m_sheet.AddPage(&m_page3);
m_sheet.AddPage(&m_page4);
m_sheet.AddPage(&m_page5);
m_sheet.AddPage(&m_page6);
m_sheet.Create(this, WS_CHILD | WS_VISIBLE , 0);
m_sheet.ModifyStyleEx (0, WS_EX_TRANSPARENT);
m_sheet.ModifyStyle( 0, WS_TABSTOP );
m_sheet.SetActivePage(4);
m_sheet.SetActiveWindow();
// move to left upper corner
m_sheet.SetWindowPos( NULL, 0, 0, 0, 0,
SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );
...
Can any one help
thanks
si
|
|
|
|
|
for sheet, it is better to active all pages if u can.
try to add code at last.
int i,iNum=m_sheet.GetPageCount();
for(i=0;i<iNum;i++) m_sheet.SetActivePage(i);
m_sheet.SetActivePage(4);
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
thanks but thats hasnt solved it , any other ideas ??
|
|
|
|
|
please tell me how can i get .exe file path which is runnable file of my project and is running now.
thank you.
|
|
|
|
|
u can use GetModuleFileName() to get the path of the executable including the file name..
u can then remove the filename from that pah to get the working directory..
This filename can be removed either manually or use PathRemoveFileSpec()
nave
|
|
|
|
|
|