|
The Curses library allows multiple panels or "windows" in text terminal or console applications. There are commercial implementations of Curses for windows, and I suppose there's a port of the free ncurses library somewhere.
|
|
|
|
|
I would like to save the printer info in some variables so that the user can just press any button and volla. I want to code this myself into one of my controls. I also want to avoid doing a DoModal on CPrintDialog because this would stop my thread while the dialog is open. Also, I do not believe the dialog can do Modeless.
Can I save the HDC to the printer and its DevMode stuff to a member variable in my control without any problems? Will it interfere if there is another app and its uses the printer or another printer driver etc?
Appreciate any responses.
|
|
|
|
|
I have a heavy calculating function that runs on a machine with twelve processors. I have divided the calculation in 12 similair pieces to improve calculation. The calculation runs in 12 threads. The main calculation function starts 12 threads, one for each processor. I wish to send som parameters to the threads via the main calculation function. But a threadprocedure takes a pointer to void as argument. I must therefore send a pointer to a struct. But how can I preserve const for some of the arguments? const members of the struct doesnt work since the values are parameters to the function that starts the threads.
|
|
|
|
|
In the thread function why can't you have:
const MyStruct* pMyStruct = static_cast<mystruct*>( lpVoid );
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I'm not sure if this is what you're asking, but this example shows how you can define a struct with const references to some external variables:
struct calculation_parms
{
const int& parm;
calculation_parms(const int &parm):parm(parm){}
private:
calculation_parms(calculation_parms&);
calculation_parms& operator=(calculation_parms&);
}; Another issue having not to do with this is that, IMHO, Windows OSs do not distribute threads acrosss several CPUs (the distribution is done on a per-process basis). If I'm right, this scheme of yours won't help speed up the calculations (you'd have to launch 12 separate processes.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Wish: to have the paramter src to of the function threadedblurfilter const.
--START CODE EXAMPLE--
#include <stdio.h>
#define _REENTRANT
#include <pthread.h>
#include <math.h>
#include "blurfilter.h"
#include "ppmio.h"
typedef struct
{
int xsize;
int ysize;
pixel *src;
pixel *dst;
int radius;
double *weight;
int ystart;
int yend; /*blurfilter calculates including this coordinate.*/
} blurinfo_t;
void *blurfilter(void *);
void threadedblurfilter(const int xsize, const int ysize, pixel *src, pixel *dst
,
const int radius, double *weight, const int nthreads)
{
blurinfo_t *blurinfo = (blurinfo_t *)malloc(nthreads * sizeof(blurinfo_t));
pthread_t *threadId = (pthread_t *)malloc(nthreads * sizeof(pthread_t));
int i, j;
int npixelsperthread = ysize / nthreads;
int ypos = 0;
int breakreached = 0;
for (i = 0; i < nthreads; i++)
{
if ((double)(ysize - ypos) / (double)(nthreads - i) ==
(ysize - ypos) / (nthreads - i) &&
breakreached == 0)
{
breakreached = 1;
npixelsperthread++;
}
blurinfo[i].radius = radius;
blurinfo[i].weight = weight;
blurinfo[i].xsize = xsize;
blurinfo[i].ysize = ysize;
blurinfo[i].src = src;
blurinfo[i].dst = dst;
blurinfo[i].ystart = ypos;
blurinfo[i].yend = blurinfo[i].ystart + npixelsperthread - 1;
pthread_create(&threadId[i], NULL, blurfilter, &blurinfo[i]);
ypos += npixelsperthread;
}
for (j = 0; j < nthreads; j++)
{
pthread_join(threadId[j], NULL);
}
free(threadId);
}
void *blurfilter(void *p)
{
blurinfo_t *blurinfo = (blurinfo_t *)p;
//Lots of heavy calculations.
}
--END CODE EXAMPLE--
|
|
|
|
|
how can i change edit font color???
|
|
|
|
|
if u r using a DC to output u'r text, then u can change u'r font color by setting DC's SetTextColor property
Ashok Singh
<west end="" india="">
|
|
|
|
|
Use CDC::SetTextColor in CWnd::OnCtlColor . I think there are some good articles explaining this on CP.
Cheers
/moliate
|
|
|
|
|
//this is how i set the size and the ==== bold
//setting edit box yfont size
LogFont.lfHeight = 15;
LogFont.lfWeight = FW_BOLD;
newFont.CreateFontIndirect(&LogFont);
GetDlgItem(IDC_EDIT1)->SetFont(&newFont);
CEdit* smpEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
smpEdit->SetWindowText(afileName);
|
|
|
|
|
Read Mike Dunn's FAQ. It will answer 50% of all commonly asked questions.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
how to make a Item in CTreeCtrl invisible.
Thank you!
|
|
|
|
|
Delete it or create your own tree control.
|
|
|
|
|
since you know about ctreectrl let me please ask one question
do you know what is wrong in the following code? i mean.. i'm trying to sort the files by name, by type,by size, or by date (based on user choice). so i have to use SortChildrenCB() instead of SortChildren().
but the callback function is never got excuted.
do u know why?
|
|
|
|
|
since you are using ctreectrl let me please ask one question
do you know what is wrong in the following code? i mean.. i'm trying to sort the files by name, by type,by size, or by date (based on user choice). so i have to use SortChildrenCB() instead of SortChildren().
but the callback function is never got excuted.
do u know why?
|
|
|
|
|
ShowWindow( SW_HIDE ) should workk.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
NO,i want invisible a one Item,no a whole Windows.
|
|
|
|
|
jieg wrote:
NO,i want invisible a one Item,no a whole Windows.
You could overide the on item draw notification and draw something to indicate the item isn't available.
Other than that I don't think this is possible. You either need to remove the item from the tree control or possibly write your own tree control.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
i have a application that prints all kinds of files using shellexecuteex(). the program printed a:\one\k.jpg and a:\one\m.tif yesterday... but right now when i using my application to print same two files again, the following error message pops up.
" a:\one\k.jpg is not valid to win32 application"
and
" a:\one\m.tif is not valid to win32 application"
why both of them print before and not now.. i could not find the reason..
please answer me if you know the reason.. thanks
|
|
|
|
|
Can you post the relevant code snippets, please?
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
//here how i print the file.
//calling print function and passing the file name to print.
print("c:\one\k.jpg");
void print(CString fileName)
{
SHELLEXECUTEINFO lpExecInfo;
CString print = "print";
SetShellExecuteInfoStructure(lpExecInfo,print,fileName);
int success = ShellExecuteEx(&lpExecInfo); // printing a file
if(success == 0)
MessageBox("Fail");
}
void SetShellExecuteInfoStructure(SHELLEXECUTEINFO &lpExecInfo,CString lpVerbToPrintOrOpen, CString lpFile)
{
const char* verb = lpVerbToPrintOrOpen;
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
lpExecInfo.lpFile = lpFile;
lpExecInfo.fMask=SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS ;
lpExecInfo.hwnd = NULL;
lpExecInfo.lpVerb = verb;
lpExecInfo.lpParameters = NULL;
lpExecInfo.lpDirectory = NULL;
lpExecInfo.nShow = SW_SHOW;
lpExecInfo.hInstApp = (HINSTANCE) SE_ERR_DDEFAIL ; //WINSHELLAPI BOOL WINAPI result;
}
|
|
|
|
|
Win wrote:
print("c:\one\k.jpg");
This can be achieved in a lot simpler manner as follows :-
ShellExecute(this->m_hWnd,"print",
"c:\\one\\k.jpg","","",
SW_HIDE);
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
no.. i can't use it because my application is printing program.. i have to print tons of files (any kinds of files). it has to be sent one file after printed one file. otherwise, the file will not be in order. so i need to know whether current file is finish printing and if finished, send another file. otherwise, wait until the first file is completely printed. so i have to use shellexeuteex(). and i suprised, it was fine printing .jpg and .tif files until yesterday and only starting from yesterday, could not print .jpg and .tif files.. i can't find the reason why can't print. do you have any idea why???
|
|
|
|
|
Win wrote:
do you have any idea why???
Because you are using \ instead of using \\ in your file name strings
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
Hi all... i have an application,which include, checkboxes, radio buttons and tree controls that's act like window explore.
i want to save the user current setting so next time when the user rebrowse the folder he/she browsed last time.
how can i do that.????
thanks
Win
|
|
|
|