|
One way would be:
char *m_Str = "Test A";
char *Str = " of";
char szResult[10] = {0};
strncpy(szResult, m_Str, 4);
strcat(szResult, Str);
strcat(szResult, &m_Str[4]);
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
Does anyone know how to hide a window's title bar on a Win32 app?
Thanks in advance!
|
|
|
|
|
Use SetWindowLong API call and pass in a modified windows style. Look up the various WS_XXX window styles in MSDN. I *think* (off the top of my head) that you want to remove the WS_CAPTION style. But you may also have to remove others.
Once you have modified the style you need to call SetWindowPos like so:
::SetWindowPos( hwnd_, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE );
SWP_FRAMECHANGED is the critical part that causes Win32 to refresh the window properly.
You can use GetWindowLong(GWL_STYLE) to get the orginal window style and then modify that accordingly.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Hi,
Thanks for the help but I cant make it work. I can remove other WS_*** styles but not WS_CAPTION. For some reason my window has a caption bar by default. Do you know any possible reasons why?
Thanks again!
|
|
|
|
|
You might have to remove other window styles that would also cause Windows to draw a caption bar. The ones that come to mind are WS_MAXIMIZEBOX , WS_MINIMIZEBOX , WS_OVERLAPPEDWINDOW and WS_SYSMENU , but there may be others as well.
|
|
|
|
|
How to change font color and backround color C++ program
|
|
|
|
|
In CView::OnDraw(CDC* pDC) or using the CDC *pDC=GetDC() member function
//To Set font color
COLORREF oldCol=pDC->SetTextColor (RGB(0,0,255));//Blue Color
// use font to draw stuff
//.....
pDC->SetTextColor (oldCol);//restore old font color
//the same Way to set back ground color
COLORREF OldbkColor=pDC->SetBkColor (RGB(0,0,0));
//Do your drawing
//......
//if U want to restore BK Color
pDC->SetBkColor(OldbkColor);
|
|
|
|
|
what about dialog based programs ?
TOXCCT >>> GEII power
|
|
|
|
|
see this arrticles
http://www.codeguru.com/Cpp/W-D/dislog/background/article.php/c1849/
http://www.codeguru.com/Cpp/W-D/dislog/background/article.php/c1895/
|
|
|
|
|
For dialog based programs, you will have to override a handler WM_CTLCOLOR. This can change the colors of all the controls on a dialog and the color of the dialog itself.
<marquee> STUCK STUCK STUCK STUCK
Stuck to Programming through an unbreakable bond
My Articles | My Blog
|
|
|
|
|
How to change font color and backround C++ program
|
|
|
|
|
Where you want change color : in control, in view, int title bar ... ?
|
|
|
|
|
Hello guys...
Now, i am currently working to develop an application for my school project. My project is making communication between two computer via telephone line using modems.I wanted to enhance my application, and here is my question :
How do I add an event sound to my application? (i.e. when one computer making call to another, and its receive "RING" message from modem and produce sound (ring.wav)
->> I mean, when one computer receive "RING" message (its shows in edit box), i want the computer produce ringing tone.(some sound alert for the user)
Beside that, when the transfer of data is complited, the computer produce sound for this event.
I have surfed the web for examples and tutorials, but majority of them seem to be a little too advance for me. If someone out there can explain the basics to me, along with a simple example, I would really appreciate it.
|
|
|
|
|
In your .cpp file you have to include mmsystem.h and link to the winmm library. You can then use PlaySound to play .wav files.
#include <mmsystem.h>
#pragma comment (lib, "winmm.lib")
.
.
.
PlaySound(_T("Ring.wav"), NULL, SND_ASYNC | SND_FILENAME);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
hello programmers,
the last code snippet from here:
http://www.codeproject.com/cpp/CPPMathFun.asp
woun't compile ,
here it is:
#include
using std::cout;
using std::endl;
template<int n="">
class CalculateCycle
{
public:
enum { count = CalculateCycle&t N % 2 ?
(N * 3 + 1) : (N / 2) >::count + 1 };
};
template <>
class CalculateCycle<1>
{
public:
enum { count = 1 };
};
int main(int argc, char* argv[])
{
const int iNo = 22;
cout << "Cycle length of " << iNo << " is = "
<< CalculateCycle<ino>::count << endl;
return 0;
}
the article is called
Template Meta-programming
please help, what can I do ?
// Lord Byte has started to code
void swap(char **p, char **q)
{
char *tmp;
tmp = *p;
*p = *q;
*q = tmp;
}
|
|
|
|
|
hi!
i have the following line which i print output to the user:
printf("%s:%f\t %s:%f\t %s:i\n", "Mean",mean,"Variance",var,"Number",N);<br />
now i hope to instead write these values into a text file. is there any way i can do it?
thanx!
|
|
|
|
|
Try looking up the functions fopen() , fprintf() , and fclose() .
Software Zen: delete this;
|
|
|
|
|
http://www.geocities.com/stormcatcher712/sample.html[^]
Its an image of my private project. I'm still a beginner an so I have several questions.
First some word about the structure of my application. It is a single doc app created with the VC++ 6.0 project wizard. At the right site you see the applications docview. It contains a CListCtrl. At the left side I managed to add a CDialogBar with a dialog conaining a CTabCtrl. If you switch the tabs the checkbuttons and texteditfields will be activated or deactivated.
Now my questions:
1) I want to manipulate the CListCtrl from within the CDialogBar dialog. If you push the start button some processing should be done and the result should be displayed in the right View. How can I do this? As I see it there is no way to give the doc or view class access to the dialogbar class and the other way too.
2) Isn't there an easy and simple example of an application that uses register cards and diffent dialogs on every page? You know like the preferences dialog unter Visual C++ -> Project -> Preferences ? Or think about the tiny search program for Windows 95, 98, 2000? It has all elements I need for my application. Different Dialogs with a propertysheet, and the result of the processing is displayed in an explorerlike Listview. Although it is just a simple application I did not see sourcecode for a similar program.
Thank you for your time and help!
|
|
|
|
|
ryuki wrote:
As I see it there is no way to give the doc or view class access to the dialogbar class and the other way too.
For MFC SDI applications :
((CFrameWnd*)AfxGetMainWnd())->GetActiveView() return pointer to you CView class,
((CFrameWnd*)AfxGetMainWnd())->GetAcviteDocument() return pointer to you CDocument class.
|
|
|
|
|
That simple... I read "MFC in 21 days", and they mentioned it earlier but I forgot. Sometimes I wonder if I will ever get used to the whole document - view and message concept of MFC. Think about that, there is no member for the CYOURDoc and CYOURView in any class in your whole project.
Thank you again!
|
|
|
|
|
do you know c++ class ?
<br />
class CYOUView : public CView<br />
{<br />
int m_int;<br />
};<br />
If you try compile that string:
<br />
... GetActiveView()->m_int ...<br />
you got error "m_int not member of class CView"
but if you write:
<br />
... ((CYOUView*)GetActiveView())->m_int ...<br />
that will compile, and work whith no error's
|
|
|
|
|
Hi All,
I'm sure this has been asked coutnless times before but i'm buggered if i can find the answer anywhere.
Got an MFC dialog app. I want to DoModal on the first dialog, and then if the ok button was clicked, create a different dialog and DoModal on that.
But the second dialog just returns immediately.
Any ideas?
Jon
|
|
|
|
|
Remove m_pMainWnd assigment from CWinApp::InitInstance and will work
|
|
|
|
|
make sur the second dialog is a member variable of the first dialog class. and is created with new , not just created on the stack in the function that creates the second dialog.
something like
m_pSecondDialog = new MySecondDialogClass;
m_pSecondDialog->Create( ... );
instead of
MySecondDialogClass dlg;
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I was using the code for high color bitmaps in "http://www.codeguru.com/Cpp/G-M/bitmap/article.php/c1721/" and i created a class which can be used for image loading and displaying from a resource the CBitmap and Cpalette are member vars of the class .
I used the class in a game where there are different levels and the number of images is incresed as the level increases then i noticed that the program occasionaly faces the from of creating a compatible dc then i noticed that using the resource meter that level after level the GDI resource is falling in the class destructor i used detach and deleteObject for each CBitmap and Cpalette member but the gdi resource starts falling to a critical level and thats when the program fails to create a compatible dc after closing the window the GDI is restored to its orignal level but as the level increases the GDI level falls?????
what can be done after each level to restore the GDI resources
|
|
|
|