|
I tried with some skins.. look and feel is good. but the placement of controls differ for different OS. So i changed my mind to program the same.
If there is any free skin development tools let me know. I can try one more time...
|
|
|
|
|
Change the background to what? Like Christian stated, you can draw a bitmap. Or you can make the
background a different color.
What do you want to do?
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
I have a program using C++. This program created a file. I want to delete a particular record in this file. How to do this?
|
|
|
|
|
What sort of file is it ? Probably the answer is, you need to read the entire file, remove the record, and write it back out again.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It's a binary file. I've opened the file using this statement,
fstream ofs("studfile.txt",ios::out|ios::app|ios::in);
I displayed the contents of the file using,
char ch;
int beg,end;
ifstream ifs("studfile.txt",ios::in);
while(ifs)
{
ifs.get(ch);
cout<
|
|
|
|
|
If it's not a txt file, why is it named .txt ?
Either way, why are you reading it one char at a time ?
The answer is unchanged - you need to read the whole thing in, modify it in memory, then overwrite it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Does this file a text file?
|
|
|
|
|
It's a binary file. I've opened the file using this statement,
fstream ofs("studfile.txt",ios::out|ios::app|ios::in);
I displayed the contents of the file using,
char ch;
int beg,end;
ifstream ifs("studfile.txt",ios::in);
while(ifs)
{
ifs.get(ch);
cout<
|
|
|
|
|
Hi
Since you have created the file. The structure of the file can be defined by your self so that the random position of the record can be obtained with lesser seek operation and move the remaining portion of the file.
You can define your own methods appropriately to the organisation of the file structure.
Best Regards
Raj
|
|
|
|
|
Hello,
in a subproject,while compiling a cpp file which includes afximpl.h, I'm getting the following error message:
c:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\..\\src\\mfc\\afximpl.h(734) : error C2976: 'CArray' : too few template arguments
The error is caused by a class CVariantBoolConverter, also in afximpl.h:
class CVariantBoolConverter <br />
{<br />
protected:<br />
CArray'<'CVariantBoolPair> m_boolArgs;<br />
public:<br />
...
As CArray is forward declared in afx.h as
template'<'class TYPE, class ARG_TYPE><br />
class CArray;
C2976 occurs because of the missing ARG_TYPE argument in the CVariantBoolConverter declaration.
So far so good... but when I dig deeper to the original declaration of CArray in afxtempl.h:
template'<'class TYPE, class ARG_TYPE = const TYPE&><br />
class CArray : public CObject<br />
{<br />
public:<br />
CArray();<br />
...
ARG_TYPE is suddenly optional!
This is clearly a mismatch between the forward and real declaration of CArray, but the question is why am I the only one wich seems to be having problems with this bug?
We already have successfully converted other projects using templates without errors in my company, and I can't find anyone via Google or Usenet who is having the same or a similar problem.
Since I'm completely and now I hope someone can shed a ray of light on this...
adTHANKSvance, Skarrin
|
|
|
|
|
I thought CArray always had two args ? I guess it's too late to convert this code to standard C++, but for future reference, using the standard containers ( such as vector ), would insulate you from these sort of issues.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: I thought CArray always had two args ? I guess it's too late to convert this code to standard C++, but for future reference, using the standard containers ( such as vector ), would insulate you from these sort of issues.
The code snippets I posted are all located in Microsofts very own header files .
The cgraph.cpp file which causes the error does not use any template classes itself, it just includes afximpl.h because it calls other functions like AfxGetFileTitle defined there.
(In case anyone knows it, the subproject making trouble is an old commercial product called "Graphics Server 5" from "Bits Per Second Ltd.", which we last upgraded before 2000 ).
Regards, Skarrin
|
|
|
|
|
It works fine for me, even using the default (omitting the) 2nd template parameter.
Some things to check:
Make sure afxtempl.h is included before trying to define a CArray class.
Make sure the TYPE used in the definition is defined before trying to define a CArray class using
that type.
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
I have a CButton on which I load an Icon. I set the Icon property of the button to true and load the icon using the LoadImage() function as follows:
HANDLE hIconHandle = ::LoadImage( AfxGetResourceHandle(), MAKEINTRESOURCE( IDI_MYICON), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT );
::SendMessage( m_button.m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) (DWORD) hU );
The tool tips show only if the mouse is on the border of the button and not on the image. The button is placed on a mode less dialog.
Any ideas on how can I get the tool tip to show when the mouse is over the button?
P.S: I don't want to add a new class to implement this functionality...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
When you run this code what happen?
void CDialogDlg::SetToolTip(LPCTSTR Text,HWND hwnd)
{
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.lpszText = (LPTSTR)Text;
ti.hinst = AfxGetInstanceHandle();
ti.hwnd = hwnd;
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.uId = (UINT) hwnd;
m_tooltip.SendMessage(TTM_ADDTOOL, 0, (LPARAM) &ti);
}
void CDialogDlg::OnBnClickedCancel()
{
m_tooltip.Create(this);
m_Button.ModifyStyle(BS_BITMAP,BS_ICON);
m_Button.SetIcon(LoadIcon(AfxGetApp()->m_hInstance,(LPCTSTR)IDI_UP));
SetToolTip("Test",m_Button.m_hWnd);
}
|
|
|
|
|
The image on the button disappears when I click on the Cancel button for the first time and is not displayed again. The application crashes when I click on Cancel button for the second time (but this can be handled)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Yeah you got an error because you have this function on the cancel m_tooltip.Create(this); you must remove this function of Oncancel I tried to work with this code and it worked and I could see image on the button before and after click.
|
|
|
|
|
Do we have a substitute for PreTranslateMessage in Modeless dialog. I guess I have figured the problem and now I need a substitute...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I need to load 2 bitmaps alternatively on the arrow mark of the combo contol(owner draw combo cotrol). This process should take place continuously so that the arrow mark looks as if it is blinking.
if have done this by using a timer which calls the code every second. But after some time the application is being CRASHED.
The code i have used is ,
if(variable == TRUE)
{
m_ctlMode.SetBitmap(IDB_BITMAP_COMBO);
variable = FALSE;
}
else
{
m_ctlMode.SetBitmap(IDB_BITMAP_RED);
variable = TRUE;
}
m_ctlMode.Invalidate(TRUE);
Here m_ctlMode is the control variable of the combo box.
Please can anyone say me how to come out of this problem
Naveen
|
|
|
|
|
Does it crash in debug mode? After which line? Does it work for a long time? In your owner draw function, or in the windows one?
Does your SetBitmap function have a memory leak? A resource leak?
You need to hunt for a few more clues to give us than "it crashes"...
Iain.
|
|
|
|
|
The Application is executing for almost 45 minutes and then its getting crashed. I am not aware of memory leak, resource leak of SetBitmap function . I have kept the code in OnTimer function which calls for every 0.5 second . Can u say me how to find the Memory leak or resource leak of the SetBitmap function.
|
|
|
|
|
1/ If you reply to your original message instead of my reply, I don't get notified that you replied. Strangely enough, I don't spend my time refreshing this page. Shocking, I know...
2/ You haven't answered my question about *where* your program is crashing. If it doesn't crash when compliled with debug symbols, that's a clue. If you can't be bothered to run the program from the IDE so you see the crash, then its going to be too hard to help you.
3/ Try commenting out the lines that actually change the bitmap, and just Invalidate the control. Does it still crash?
4/ Speed up the timer, so the error happens faster - probably
5/ You can see memory use by using task manager. Does the working set slowly increase?
6/ My prime suspect is still resources. For that you need to be highly paranoid about matching up every LoadImage with a DeleteObject call. Do you create fonts in your owner draw routine, but don;'t tidy up? Etc. Nobody here can help you with that, you'll just have to remove chunks of code, and slowly add them back and go over them with a fine tooth comb.
I hope that helped a bit,
Iain.
|
|
|
|
|
Dear Clarke,
I have executed in the following ways.
1. when i have tried with loading only 1 bitmap and invalidating the same there is now change and application got crashed.
2. I have used DeleteItem before loading the bitmaps. But there is no use.
3. When i have speed up the Timer its crashing fast when compared to before.
when timer is called at 500msec --- crashed after 40 min
when timer is called at 50msec --- crashed after 4 min
4. I have seen the memory use in the task manager but there is no increase in it.
5 I have used these commands for invalidating a. Invalidate
b. RedrawWIndow
c. ValidateRgn etc.
but there is no use.
6. I have Executed in Debug mode and the control is always going to OnCtlColor.
I am suspecting that it is due to continuous loading of bitmaps on the same control. Please reply me regarding this .
|
|
|
|
|
Then you already have 90% of the answer...
My guess is that you're creating a new brush every time the OnCtlColor function is called. In the MSDN article for the same thing, it returns the same handle all the time - WM_CTLCOLOR does not delete the handle after it's used.
From MSDN page:
HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
{
pDC->SetTextColor(RGB(255, 0, 0));
pDC->SetBkMode(TRANSPARENT);
hbr = m_brush;
}
return hbr;
}
I'd make sure that you are not creating the brush each time (the example returns m_hBrush . Remove almost all your code to just making the things (eg)purple, then build up and see where things fail.
Iain.
|
|
|
|
|
Maybe this answer has already been given...
I can't find any SetBitmap() method that takes an ID as a parameter but it makes it look
like you're loading a new bitmap resource every time, without freeing the previous loaded bitmap.
How about loading the two bitmaps in advance (only ONCE) and set those bitmaps in response to
the timer event?
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|