|
Hi,
I did as follows in that order & I get the child control to exceed the parent window.
childControl.SetParent(GetDesktopWindow());
childControl.ShowWindow(true);
childControl.BringWindowToTop();
childControl.SetFocus();
childControl.MoveWindow(500,300,400,200);
But now the problem is ,I don't get the childControl as an activeWindow(Can't select,edit anything etc).
Thanks..
|
|
|
|
|
hi, I have a thread function that starts when user press OnRun button. I want that when user click on OnStop button I want the code the behind Stop button kill the thread. How can I do that..
The code is here
void CAppDlg::OnRun() <br />
{<br />
<br />
AfxBeginThread(ThreadFunction, this); <br />
}<br />
<br />
void CAppDlg::OnStop() <br />
{<br />
<br />
??????????????????<br />
}
|
|
|
|
|
just declare a boolean flag which you switch in your OnStop() function...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Try AfxEndThread(..,..)
void AFXAPI AfxEndThread(
UINT nExitCode,
BOOL bDelete = TRUE
);
This will end the current thread.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
MuratMetu wrote: hi, I have a thread function that starts when user press OnRun button. I want that when user click on OnStop button I want the code the behind Stop button kill the thread. How can I do that..
In Continuation With Tox....
you also try your hand on TerminateThread api.. but use it in speacial circumstances only.... i am listing the name of api for your information only
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi all
I've been teaching C++ for about 10 years (unmanaged using Borland Compilers), and for the first time this year I am teaching managed C++ using MS Visual Studio .NET. The first part of the course concentrates on procedural programming in a console environment, and one of the topics is writing / reading to text files (which is OK), and printing data to a printer (local LPT1 printer). In unmanaged code, I would write is as follows :
#include <fstream.h>
void main(void)
{
char data[80];
ifstream infile;
ofstream printer;
infile.open("TEST.TXT", ios::in);
printer.open("PRN");
while (infile)
{
infile.getline(data,80);
if (infile)
{
printer << data << "\n";
}
}
};
However, I cant find a simple way to set up a stream to the local printer in a console based environment using managed code. The file handling part is fine, and would look as follows :
// Filein1.cpp
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
int _tmain()
{
String *record;
StreamReader * fileIn = File::OpenText(S"Test.txt");
// Need to set up stream to printer here
while ((record = fileIn->ReadLine()) != 0)
{
Console::WriteLine(S"{0}",record); // need to replace with output to printer stream
}
Console::ReadLine();
fileIn->Close();
return 0;
}
Can anyone help me fill in the gaps ?
Many thanks
Simon Cornish
|
|
|
|
|
|
I'm creating a procedure to add bitmap image on status bar.
The problem is i don't know how to do it. If you know some links,
articles or know how to do it, please reply to my post. Your help
would be greatly appreciated. Thanks!
|
|
|
|
|
Does anyone know how to use this!
I need to make the background of my AVI transparent. I'm capturing the OnCtlColorStatic message, but what next?
I search the docs and the web but have found conflicting examples. Should I be returning a BOOL from this message (to say I've handled it) or a HBRUSH? or something completely different!
I'm lost - Can anyone shed any light on this (a snippet of code would be useful!)
Kevin.
|
|
|
|
|
Have you set the ACS_TRANSPARENT style when you created the control? That should be all you have to do.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Hello
How can one make a tooltip alpha blended? I've grabbed the code from MSDN, and added a WS_EX_LAYERED style to the tooltip and call to SetLayeredWindowAttributes(), which seems to be enough. But it does not work. Here's code:
void CreateMyTooltip (HWND hwnd)
{
// struct specifying control classes to register
INITCOMMONCONTROLSEX iccex;
HWND hwndTT; // handle to the ToolTip control
// struct specifying info about tool in ToolTip control
LPTOOLINFO ti;
unsigned int uid = 0; // for ti initialization
char strTT[30] = "This is your ToolTip string.";
LPTSTR lptstr = strTT;
RECT rect; // for client area coordinates
/* INITIALIZE COMMON CONTROLS */
iccex.dwICC = ICC_BAR_CLASSES;
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCommonControlsEx(&iccex);
/* CREATE A TOOLTIP WINDOW */
hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS,
NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP | WS_EX_LAYERED| WS_EX_TOOLWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
300,
200,
hwnd,
NULL,
NULL,
NULL
);
SetLayeredWindowAttributes(hwndTT, 0, (255 * 70)/100, LWA_ALPHA);
gOldTooltipWndProc = (FARPROC)SetWindowLong(hwndTT,
GWL_WNDPROC,
(DWORD)TooltipWndProc);
/*SetWindowPos(hwndTT,
HWND_TOPMOST,
0,
0,
0,
0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);*/
/* GET COORDINATES OF THE MAIN CLIENT AREA */
GetClientRect (hwnd, &rect);
/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
ti = new TOOLINFO;
ti->cbSize = sizeof(TOOLINFO);
ti->uFlags = TTF_ABSOLUTE | TTF_TRACK;
ti->hwnd = hwnd;
ti->hinst = NULL;
ti->uId = uid;
ti->lpszText = LPSTR_TEXTCALLBACK;//lptstr;
// ToolTip control will cover the whole window
ti->rect.left = 0;
ti->rect.top = 0;
ti->rect.right = 0;
ti->rect.bottom = 0;
/* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) ti);
SendMessage(hwndTT, TTM_TRACKACTIVATE, (WPARAM)TRUE, (LPARAM)(LPTOOLINFO)ti);
gHwnd = hwndTT;
gpTi = ti;
}
What am i doing wrong? Thanks for help
|
|
|
|
|
Hi All,
I am in a bottleneck and need your help to come out of it. I have a Shell DLL which will load from a USB CDROM media. When the shell is loaded and my computer is open the tray Icon on the system tray is not allowing me to stop the device. To overcome this I have to logoff logon each time. I tried the normal ways of Unloading the shell DLL (By using DllCanUnloadNow()) still no use.
Thanks for your help in advance,
Raja.
|
|
|
|
|
i am a final year student from uitm.right now i am doing my final year project. i got a problem on how to develop a chat appliCation by using c++ language. my thesis title is ipv6 multicast chat application. i have to create a chat application for this. it doesn't matter whether it is a simple one.but i do not have enough skills in programming language. i have try to do it but not success. so i really really hope that if someone here who are really capable of doing chat application using c++ programming to help me.
so someone please HELP me.
-- modified at 7:48 Thursday 24th November, 2005
|
|
|
|
|
Hello,
I'm trying to modify a black&white bmp file by replacing certain areas with the data obtained from other bitmaps. I have no problem in doing this with the gdi+ functions. My problems have arrived when I have tried to insert strings in some places in the bmp file. I just don´t know how to do it. Can anybody give me the clue?
Any help will be really appreciated,
Itziar
|
|
|
|
|
If you are using GDI+, use
DrawString( ) with SetTextRenderingHint() and SetInterpolationMode.
Cheers
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thank you for your help. I´ll have a look at these functions, but one more question, aren´t they used to display images? You see, I want the text to be saved into the bmp file. I´m not displaying images.
Itziar
|
|
|
|
|
You can take the Graphics object of a bitmap and draw directly to it. You can then save the Bitmap using the Save method.
Cheers
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thanks. It's worked fine for colored bmps.
Itziar
|
|
|
|
|
Hi !
I want to check if a specific folder exists. I looked in the MSDN but could not find anything...
Any idea ?
Thanks
|
|
|
|
|
Hello.
You can use stat() / _stat()
Or _access()
Kakan
|
|
|
|
|
Thanks
|
|
|
|
|
Try PathIsDirectory( ) or PathFileExists( )
Cheers
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi,
CreateDirectory will return ERROR_ALREADY_EXISTS if the specific directory already exists.
Bye
Cool Ju
Dream Ur Destiny
|
|
|
|
|
if( (DWORD)-1 == GetFileAttributes(szDirectory) ){
// does not exist
} else {
// file or directory exists
}
|
|
|
|
|
Hi,
I am creating a shell namespace extension to show FTP files. I implemented cut / copy and paste using CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR. I implemented IDataObject and IStream for this. After copying, when I choose to paste the files, I am getting all the files, But the problem is that, the directory structure is not retained.
If I am copying a folder say "Test", which contains 2 files
1. a.txt
2. b.txt
When I choose paste, I am getting 2 files ( a.txt and b.txt ) and a folder ( Test ) in the same place. In fact it should have been folder "Test" and the two files inside "Test". But that is not happening.
I believe I am missing something here...
Could somebody please help me in resolving this.
Thanks and Kind Regards
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|