|
nick2reg wrote: Anyone know how to disable this ?
Yes, consult this.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I'm stumped on this one
I have a class, with a private unsigned char array.
I have a class method which is const. It is trying to write to the private unsigned char array, but I get the assignment of read only location.
I can't touch the headers/remove the const because it is an inherited virtual function. How do I access the unsigned char array?
modified on Wednesday, May 6, 2009 12:40 PM
|
|
|
|
|
jeweladdict wrote: private unsigned char array
I presume it's private in your derived class (it's difficult to tell, as you haven't posted the code...). In that case, declare it as mutable . That way you can modify it even in a const method.
However, unless (say) the array is a cache, is the design correct?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
you sir, are a god
Saved me a lot of coding...
|
|
|
|
|
1. Hãy tổ chức lớp và viết chương trình ứng dụng cho phép nạp và hiển thị các loại tập tin ảnh có phần mở rộng thuộc một trong các loại .jpg, .bmp, .dib, .gif. Chương trình có chức năng thay đổi ảnh như lật ngang, dọc (mirror), quay 900, đổi sang mức xám, lấy âm bản, lấy sai biệt của hai ảnh và chức năng lưu trữ sang dạng khác (nhưng vẫn là một trong các dạng kể trên).
Yêu cầu: Tổ chức theo tư tưởng hướng đối tượng. Có thể lập trình trong môi trường Windows. Không xử dụng hàm static như ví dụ trong phần lý thuyết, không dùng switch, case trong chương trình.
2. Một “đầu vào thư mục” là một thư mục hoặc một tập tin, một thư mục gồm nhiều “đầu vào thư mục”. Ổ dĩa là một trường hợp đặc biệt của thư mục. Hãy tổ chức lớp để có thể biểu diễn khái niệm máy tính, ổ dĩa, thư mục, tập tin với các mối quan hệ như trên. Viết chương trình ứng dụng cho phép xem nội dung các loại đối tượng trên theo dạng tương tự như chức năng Tree của phần mềm NC.
3. Cho các loại đối: hình tròn, hình ellipse, đa giác, hình bán nguyệt, hình cánh quạt, hình thoi, hình bình hành, hình thang, hình chữ nhật, hình vuông, hình tam giác, tam giác vuông, tam giác vuông cân. Viết chương trình ứng dụng cho phép tạo (hoặc nhập) hai hình thuộc một trong các hình kể trên. In thông báo cho biết hai hình có giao nhau không, nếu có to màu phần giao và tô đậm đương biên của phần giao. Người sử dụng có thể bấm các phím mũi tên để di chuyển một trong hai hình, phím +, -, để phóng to thu nhỏ một trong hai hình. Chương trình có thể hoạt động với các loại thiết bị xuất khác nhau: Chế độ đồ hoạ, chế độ văn bản (mỗi dấu ‘*’ là một pixel luận lý). Chương trình có khả năng zoom với pixel luận lý, khi chuyển từ chế độ đồ hoạ sang văn bản hoặc ngược lại, người sử dụng không thấy các đối tượng bị to khổng lồ hoặc bé tí hon.
4. Một đường Polyline gồm nhiều đường (line), mỗi đường có thể là một đoạn thẳng (strait line), cung (arc), bezier hoặc một polyline. Tổ chức các lớp cần thiết, thiết lập mối quan hệ giữa các lớp và viết chương trình cho phép tạo các polyline, tạo bản sao của polyline, phóng to, thu nhỏ, quay polyline, phân rã polyline (tách các polyline con bên trong một polyline thành các đường đơn (line, arc, bezier), hàm xác định hai polyline có cắt nhau hay không?
|
|
|
|
|
English, please.
It is a crappy thing, but it's life -^ Carlo Pallini
modified on Saturday, May 9, 2009 2:14 AM
|
|
|
|
|
trongduy wrote:
1. Be organized classes and write the application to allow load and display all kinds of image files with the extensions in the following categories. Jpg,. Bmp,. Dib,. Gif. Programs that change the image as horizontal turn, vertical (mirror), dial 90 degree, the gray level to get the sound, get the wrong picture of the two special functions and stored into different (but still one of the significantly above).
Requirements: The thought by the audience. Can be programmed in the Windows environment. Do not use static function as eg in the theory, does not switch, in the case.
2. An "input directory" is a folder or a file, a directory of many "input folder". Drive is a special case of the directory. Be organized classes to perform concept computer, disk drive, folder, file with the relationship as over. Write the application for permission to view the content of the object type as similar functions of the software Tree NC.
3. For the types: circle, ellipse image, the polygon, crescent,'s wings, rhombus, parallelogram, trapezium, rectangle, square, triangle, triangle square, square triangle needed. Write a program that allows applications to create (or enter) the two pictures in one of the above. Notice in two pictures that are not intersecting, if any color to the bowl and the dark sea of the interface. The user can press the arrow keys to move one of two pictures, the +, - to zoom out one of the two pictures. Programs can work with all kinds of equipment in different graphics modes, text mode (each a '*' is a moral pixels). Program can zoom to pixel morally, from the graphics mode to text or vice versa, users do not see the object to be exhaustive or bé tí hon.
4. A road of many road Polyline (line), each line can be a straight section (Strait line), and (ARC), or a bezier polyline. Organization of classes necessary, establish the relationship between class and write a program that allows to create polyline, create a copy of the polyline, zoom in, zoom out, turn polyline, polyline separation (separation of the polyline in the a polyline into the road (line, arc, bezier), define two functions have polyline cross or not?
|
|
|
|
|
1. Be organized classes and write the application to allow load and display all kinds of image files with the extensions in the following categories. Jpg,. Bmp,. Dib,. Gif. Programs that change the image as horizontal turn, vertical (mirror), dial 900, the gray level to get the sound, get the wrong picture of the two special functions and stored into different (but still one of the significantly above).
Requirements: The thought by the audience. Can be programmed in the Windows environment. Do not use static function as eg in the theory, does not switch, in the case.
2. An "input directory" is a folder or a file, a directory of many "input folder". Drive is a special case of the directory. Be organized classes to perform concept computer, disk drive, folder, file with the relationship as over. Write the application for permission to view the content of the object type as similar functions of the software Tree NC.
3. For the types: circle, ellipse image, the polygon, crescent,'s wings, rhombus, parallelogram, trapezium, rectangle, square, triangle, triangle square, square triangle needed. Write a program that allows applications to create (or enter) the two pictures in one of the above. Notice in two pictures that are not intersecting, if any color to the bowl and the dark sea of the interface. The user can press the arrow keys to move one of two pictures, the +, - to zoom out one of the two pictures. Programs can work with all kinds of equipment in different graphics modes, text mode (each a '*' is a moral pixels). Program can zoom to pixel morally, from the graphics mode to text or vice versa, users do not see the object to be exhaustive
4. A road of many road Polyline (line), each line can be a straight section (Strait line), and (ARC), or a bezier polyline. Organization of classes necessary, establish the relationship between class and write a program that allows to create polyline, create a copy of the polyline, zoom in, zoom out, turn polyline, polyline separation (separation of the polyline in the a polyline into the road (line, arc, bezier), define two functions have polyline cross or not?
|
|
|
|
|
Hi,
I'm sure GDI+ can do that.
Sorry I can't provide any details, I have trouble catching the nuances of the Vietnamese language.
|
|
|
|
|
trongduy wrote:
1. Be organized classes and write the application to allow load and display all kinds of image files with the extensions in the following categories. Jpg,. Bmp,. Dib,. Gif. Programs that change the image as horizontal turn, vertical (mirror), dial 900, the gray level to get the sound, get the wrong picture of the two special functions and stored into different (but still one of the significantly above).
Requirements: The thought by the audience. Can be programmed in the Windows environment. Do not use static function as eg in the theory, does not switch, in the case.
2. An "input directory" is a folder or a file, a directory of many "input folder". Drive is a special case of the directory. Be organized classes to perform concept computer, disk drive, folder, file with the relationship as over. Write the application for permission to view the content of the object type as similar functions of the software Tree NC.
3. For the types: circle, ellipse image, the polygon, crescent,'s wings, rhombus, parallelogram, trapezium, rectangle, square, triangle, triangle square, square triangle needed. Write a program that allows applications to create (or enter) the two pictures in one of the above. Notice in two pictures that are not intersecting, if any color to the bowl and the dark sea of the interface. The user can press the arrow keys to move one of two pictures, the +, - to zoom out one of the two pictures. Programs can work with all kinds of equipment in different graphics modes, text mode (each a '*' is a moral pixels). Program can zoom to pixel morally, from the graphics mode to text or vice versa, users do not see the object to be exhaustive or bé tí hon.
4. A road of many road Polyline (line), each line can be a straight section (Strait line), and (ARC), or a bezier polyline. Organization of classes necessary, establish the relationship between class and write a program that allows to create polyline, create a copy of the polyline, zoom in, zoom out, turn polyline, polyline separation (separation of the polyline in the a polyline into the road (line, arc, bezier), define two functions have polyline cross or not?
|
|
|
|
|
trongduy wrote: 1. Be organized classes and write the application...
Which means that YOU are supposed to write it, not someone else.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
trongduy wrote: 1. Be organized classes and write the application to allow load and display all kinds of image files with the extensions in the following categories. Jpg,. Bmp,. Dib,. Gif. Programs that change the image as horizontal turn, vertical (mirror), dial 900, the gray level to get the sound, get the wrong picture of the two special functions and stored into different (but still one of the significantly above).
Requirements: The thought by the audience. Can be programmed in the Windows environment. Do not use static function as eg in the theory, does not switch, in the case.
2. An "input directory" is a folder or a file, a directory of many "input folder". Drive is a special case of the directory. Be organized classes to perform concept computer, disk drive, folder, file with the relationship as over. Write the application for permission to view the content of the object type as similar functions of the software Tree NC.
3. For the types: circle, ellipse image, the polygon, crescent,'s wings, rhombus, parallelogram, trapezium, rectangle, square, triangle, triangle square, square triangle needed. Write a program that allows applications to create (or enter) the two pictures in one of the above. Notice in two pictures that are not intersecting, if any color to the bowl and the dark sea of the interface. The user can press the arrow keys to move one of two pictures, the +, - to zoom out one of the two pictures. Programs can work with all kinds of equipment in different graphics modes, text mode (each a '*' is a moral pixels). Program can zoom to pixel morally, from the graphics mode to text or vice versa, users do not see the object to be exhaustive or bé tí hon.
4. A road of many road Polyline (line), each line can be a straight section (Strait line), and (ARC), or a bezier polyline. Organization of classes necessary, establish the relationship between class and write a program that allows to create polyline, create a copy of the polyline, zoom in, zoom out, turn polyline, polyline separation (separation of the polyline in the a polyline into the road (line, arc, bezier), define two functions have polyline cross or not?
See point 9 of this[^] post:
Chris Maunder wrote:
Nếu bạn có một trường đại học của trường hoặc chuyển nhượng, cho rằng giáo viên của bạn hoặc lecturer cũng đọc các diễn đàn.
|
|
|
|
|
I want my dialog backgroung color to be grey thus i'm using OnCtlColor event but the problem is that the controls like combo box or edit control are also geting colored with grey. Please tell me how can i change the color of my controls to white????
i used the below code where CBrush m_Brush;
HBRUSH CCTLColorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
pDC->SetBkColor(RGB(210,209,213));
//if(pWnd->GetDlgCtrlID() == IDC_COMBO1)
//{
pDC->SetBkColor(RGB(0,0,0));
//}
//if(pWnd->GetDlgCtrlID() == IDC_EDIT1)
//{
pDC->SetBkColor(RGB(0,0,0));
//}
return m_Brush;
}
BOOL CCTLColorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_Brush.CreateSolidBrush(RGB(210,209,213));
return TRUE; // return TRUE unless you set the focus to a control
}
|
|
|
|
|
If you check out the documentation[^], you learn that the nCtlColor parameter tells you what is asking for the color, so you can filter out the queries.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I want to develop a DLL that maintains a set of object instances of the same type A of which creation can be triggered by the external client code.
The external code does not explicitly know about when an instance of A could be destroyed. It's the DLL task to that in a separate thread like a garbage collector.
I have two problems :
1. concurrent access to same instance should be synchronized (the external client code is multithreaded).
2. when a client requests to work on an object instance I should be able to know that so that the garbage collector does not kill that objects.
My solution was to create critical section per-object I also ended up with a solution such that the external code never deals with a pointer to the physical object, rather a handle, an access integer.
I know there is lot of details but my hope is to give the big picture so if you know of a predefined pattern that deals with this or an existing implementation solution then I can further my choices.
Thank in advance.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
Ahmed Charfeddine wrote: I know there is lot of details but my hope is to give the big picture so if you know of a predefined pattern that deals with this or an existing implementation solution then I can further my choices.
You want an object pool[^].
Boost has a pool allocator library - but that is a memory allocator - it doesn't reuse objects directly, just memory.
There are some[^] CodeProject[^] articles - I suspect they don't meet your exact requirements, but they could well be modified to suit?
Ahmed Charfeddine wrote: My solution was to create critical section per-object I also ended up with a solution such that the external code never deals with a pointer to the physical object, rather a handle, an access integer.
One critical-section, for the object manager, should be sufficient, I think.
Your point about never having a raw pointer to an object is wise - but I'd be tempted to use some form of smart pointer that allows you to access the object directly using the handle. Boost.Flyweight[^] may be of use?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
PreSCRIPT: Apologies to post the question again, the last post has two different code snippet and makes the message bigger so reposting.
Thanks for your help in advance, i desperately need it.
--------------------------------------------------------------------
Hi There,
I am using the following example to make Win32 tab control without using MFC.
There are some business reasons that I can only use Win32 API for this.
I am able to create the tab pages. But finding weird behaviour with the messageloop.
I am making an XLL, so my dialog is opened from a selection from Excel menu item.I get a dialog box with tabs on clicking this certain menu item. Each tab has some edit boxes and buttons. which all work fine except the TAB key doesnt work to move from one item to another.
I have implemented it the same way as in above program. The problem i face are:
1. When i click on the tabs, it shows me the correct child dialog. when i change the selection of tab, it goes to the correct next dialog. so everything works fine here. But when i click on any area in the child dialog (i.e to activate the message loop), The tab key starts working on that particular selected tab, BUT after this i am not able to select any other tab. On clickin on any other tab takes me to the first tab (iSel=0)
2. When I close the dialog box from the X button in top right corner; It closes the dialog box BUT it also closes my Excel window which i dont want.
This application I am developing to configure and test some connections. so I need the excel window open after i am done with the configurations.
Please reply if you read this message. I will appreciate any help.
I have debugged it ...
it all goes fine as long as you dont click on the tab(LBUTTONDOWN) or VK_DOWN ( to focus on the page) to start the message loop.
Once you start it, Id doesnt stop i guess.
during the debug:
1. When I only clicked on the tabs and NOT on the tab dialogs( meaning not called TabPageMessageLoop() function) I can change the tabs, use the buttons int he tabs ( without the tab key working for the traversal on the controls)
2. Once i click on the tab page, or i click the down key( which start the messahe loop so that the Tab key can work in the controls), Now the tab key starts working, but only on the currentl page and when u select another tab, it displays Tab number 0( the first tab) always. so in a way the tab selection doesnt work any more.
attached is the whole code required to analyse.
Please help me finding out where the loop resets the m_lptc pointer that it always points to tab-0.
Regards
typedef struct TabControl
{
HWND hTab;
HWND hVisiblePage;
HWND* hTabPages;
LPSTR *tabNames;
LPSTR *dlgNames;
int tabPageCount;
BOOL blStretchTabs;
BOOL (CALLBACK *ParentProc)(HWND, UINT, WPARAM, LPARAM);
void (*TabPage_OnSize)(HWND hwnd, UINT state, int cx, int cy);
BOOL (*Notify) (LPNMHDR);
BOOL (*StretchTabPage) (HWND, INT);
BOOL (*CenterTabPage) (HWND, INT);
}TABCTRL, *LPTABCTRL;
static TABCTRL TabCtrl_1;
static LPTABCTRL m_lptc;
#define CMD_VK_ESCAPE 101
#define CMD_VK_RETURN 102
HINSTANCE g_hinst;
HWND hWndSummit;
static SIZE gMinSize;
static HWND frmMain;
static BOOL stopTabPageMessageLoop=FALSE;
void CAuthenticationAddin::Configure()
{
try
{
g_hinst = m_hInstance;
InitCommonControls();
DialogBox(m_hInstance, MAKEINTRESOURCE(IDD_AUTH_TAB),NULL, (DLGPROC)AuthDialogProc);
}
catch (CBaseException &e)
{
LoggedMessageBox(e, "Configure");
}
catch (...)
{
LoggedMessageBox("Unexpected exception", "Configure");
}
Log("CAuthenticationAddin::Configure() - after DisplayDialog()");
}
VOID CAuthenticationAddin::TabCtrl_OnKeyDown(LPARAM lParam)
{
TC_KEYDOWN *tk=(TC_KEYDOWN *)lParam;
int itemCount=TabCtrl_GetItemCount(tk->hdr.hwndFrom);
int currentSel=TabCtrl_GetCurSel(tk->hdr.hwndFrom);
if(itemCount <= 1) return;
switch (tk->wVKey)
{
case VK_NEXT:
{
if(0==currentSel) return;
TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel-1);
TabCtrl_SetCurFocus(tk->hdr.hwndFrom, currentSel-1);
}
break;
case VK_LEFT:
{
if(0==currentSel) return;
TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel-1);
TabCtrl_SetCurFocus(tk->hdr.hwndFrom, currentSel);
}
break;
case VK_PRIOR:
{
TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel+1);
TabCtrl_SetCurFocus(tk->hdr.hwndFrom,currentSel+1);
}
break;
case VK_RIGHT:
{
TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel+1);
TabCtrl_SetCurFocus(tk->hdr.hwndFrom,currentSel);
}
break;
case VK_UP:
{
SetFocus(m_lptc->hTabPages[currentSel]);
CAuthenticationAddin::TabPageMessageLoop (m_lptc->hTabPages[currentSel]);
}
break;
case VK_DOWN:
{
SetFocus(m_lptc->hTabPages[currentSel]);
CAuthenticationAddin::TabPageMessageLoop (m_lptc->hTabPages[currentSel]);
}
break;
default: return;
}
}
VOID CAuthenticationAddin::TabControl_GetClientRect(HWND hwnd,RECT* prc)
{
RECT rtab_0;
LONG lStyle = GetWindowLong(hwnd,GWL_STYLE);
GetWindowRect(hwnd, prc);
ScreenToClient(GetParent(hwnd), (POINT*)&prc->left);
ScreenToClient(hwnd, (POINT*)&prc->right);
TabCtrl_GetItemRect(hwnd,0,&rtab_0);
prc->top = prc->top + (6 + rtab_0.bottom-rtab_0.top);
prc->left = prc->left + 4;
prc->bottom = prc->bottom - (16 + rtab_0.bottom-rtab_0.top);
prc->right = prc->right - 12;
}
BOOL CAuthenticationAddin::TabCtrl_OnSelChanged(VOID)
{
stopTabPageMessageLoop = TRUE;
int curSel = TabCtrl_GetCurSel(m_lptc->hTab);
ShowWindow(m_lptc->hVisiblePage,FALSE);
ShowWindow(m_lptc->hTabPages[curSel],TRUE);
m_lptc->hVisiblePage = m_lptc->hTabPages[curSel];
return TRUE;
}
BOOL CAuthenticationAddin::Notify (LPNMHDR pnm)
{
m_lptc = (LPTABCTRL) GetWindowLong(pnm->hwndFrom,GWL_USERDATA);
switch (pnm->code)
{
case TCN_KEYDOWN:
TabCtrl_OnKeyDown((LPARAM)pnm);
case TCN_SELCHANGE:
return TabCtrl_OnSelChanged();
}
return FALSE;
}
VOID CAuthenticationAddin::TabControl_Destroy(LPTABCTRL tc)
{
for (int i=0;i<tc->tabPageCount;i++)
DestroyWindow(tc->hTabPages[i]);
free (tc->hTabPages);
}
BOOL CAuthenticationAddin::StretchTabPage (HWND hTab, INT iPage)
{
RECT rect;
m_lptc = (LPTABCTRL) GetWindowLong(hTab,GWL_USERDATA);
TabControl_GetClientRect(hTab, &rect);
return SetWindowPos(m_lptc->hTabPages[iPage], HWND_TOP,
rect.left, rect.top, rect.right, rect.bottom,
0);
return FALSE;
}
BOOL CAuthenticationAddin::CenterTabPage (HWND hTab, INT iPage)
{
RECT rect, rclient;
m_lptc = (LPTABCTRL) GetWindowLong(hTab,GWL_USERDATA);
TabControl_GetClientRect(hTab, &rect);
GetClientRect(m_lptc->hTabPages[iPage], &rclient);
rclient.right=rclient.right-rclient.left;
rclient.bottom=rclient.bottom-rclient.top;
rclient.left= rect.left;
rclient.top= rect.top;
if(rclient.right<rect.right)
rclient.left += (rect.right-rclient.right)/2;
if(rclient.bottom<rect.bottom)
rclient.top += (rect.bottom-rclient.bottom)/2;
return SetWindowPos(m_lptc->hTabPages[iPage], HWND_TOP,
rclient.left, rclient.top, rclient.right, rclient.bottom,
0);
return FALSE;
}
VOID CAuthenticationAddin::TabPage_OnSize(HWND hwnd, UINT state, INT cx, INT cy)
{
}
VOID CAuthenticationAddin::New_TabControl(LPTABCTRL lptc,
HWND hTab,
LPSTR *tabNames,
LPSTR *dlgNames,
BOOL (CALLBACK* ParentProc)(HWND, UINT, WPARAM, LPARAM),
VOID (*OnSize)(HWND, UINT, int, int),
BOOL fStretch)
{
static TCITEM tie;
m_lptc=lptc;
SetWindowLong(hTab,GWL_USERDATA,(long)m_lptc);
m_lptc->hTab=hTab;
m_lptc->tabNames=tabNames;
m_lptc->dlgNames=dlgNames;
m_lptc->blStretchTabs=fStretch;
m_lptc->ParentProc=ParentProc;
m_lptc->Notify=&Notify;
m_lptc->StretchTabPage=&StretchTabPage;
m_lptc->CenterTabPage=&CenterTabPage;
m_lptc->tabPageCount = 0;
LPSTR* ptr=m_lptc->dlgNames;
while(*ptr++) m_lptc->tabPageCount++;
m_lptc->hTabPages = (HWND*)malloc(m_lptc->tabPageCount * sizeof(HWND*));
tie.mask = TCIF_TEXT | TCIF_IMAGE;
tie.iImage = -1;
for (int i = 0; i< m_lptc->tabPageCount; i++)
{
tie.pszText = m_lptc->tabNames[i];
TabCtrl_InsertItem(m_lptc->hTab, i, &tie);
if (i==0)
m_lptc->hTabPages[i] = CreateDialog(g_hinst,
m_lptc->dlgNames[i],
GetParent(m_lptc->hTab),
(DLGPROC)ConfigureSummitDialogProc);
if (i==1)
m_lptc->hTabPages[i] = CreateDialog(g_hinst,
m_lptc->dlgNames[i],
GetParent(m_lptc->hTab),
(DLGPROC ) ConfigureRiskDialogProc);
if (i==2)
m_lptc->hTabPages[i] = CreateDialog(g_hinst,
m_lptc->dlgNames[i],
GetParent(m_lptc->hTab),
(DLGPROC) ConfigureUtilDialogProc);
if (i==3)
m_lptc->hTabPages[i] = CreateDialog(g_hinst,
m_lptc->dlgNames[i],
GetParent(m_lptc->hTab),
(DLGPROC) ConfigureExtDataDialogProc);
if(m_lptc->blStretchTabs)
m_lptc->StretchTabPage(m_lptc->hTab, i);
else
m_lptc->CenterTabPage(m_lptc->hTab, i);
}
ShowWindow(m_lptc->hTabPages[0],SW_SHOW);
m_lptc->hVisiblePage = m_lptc->hTabPages[0];
}
HACCEL CAuthenticationAddin::CreateAccTable (VOID)
{
static ACCEL aAccel[1];
static HACCEL hAccel;
aAccel[0].fVirt=FVIRTKEY;
aAccel[0].key=VK_ESCAPE;
aAccel[0].cmd=CMD_VK_ESCAPE;
aAccel[1].fVirt=FVIRTKEY;
aAccel[1].key=VK_RETURN;
aAccel[1].cmd=CMD_VK_RETURN;
hAccel=CreateAcceleratorTable(aAccel,1);
return hAccel;
}
void CAuthenticationAddin::TabPageMessageLoop (HWND hwnd)
{
MSG msg;
int status;
BOOL handled = FALSE;
HACCEL hAccTable = CAuthenticationAddin::CreateAccTable();
while((status = GetMessage(&msg, NULL, 0, 0 )) != 0 && !stopTabPageMessageLoop)
{
if (status == -1)
{
return;
}
else
{
handled = TranslateAccelerator(hwnd,hAccTable,&msg);
if(!handled)
handled=IsDialogMessage(hwnd,&msg);
if(!handled)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
if(stopTabPageMessageLoop)
{
DestroyAcceleratorTable(hAccTable);
stopTabPageMessageLoop = FALSE;
return;
}
DestroyAcceleratorTable(hAccTable);
PostQuitMessage(0);
return;
}
VOID CAuthenticationAddin::ResetTabPageMessageLoop (HWND hwnd)
{
stopTabPageMessageLoop=TRUE;
stopTabPageMessageLoop=FALSE;
SetFocus(hwnd);
CAuthenticationAddin::TabPageMessageLoop(hwnd);
}
BOOL CAuthenticationAddin::FormMain_OnNotify(HWND hwnd, INT id, LPNMHDR pnm)
{
switch(id)
{
case TAB_CONTROL_1:
return TabCtrl_1.Notify(pnm);
}
return FALSE;
}
void CAuthenticationAddin::FormMain_OnSize(HWND hwnd, UINT state, int cx, int cy)
{
RECT rc;
GetClientRect(hwnd,&rc);
MoveWindow(TabCtrl_1.hTab,0,0,(rc.right - rc.left)/2-4,rc.bottom - rc.top,FALSE);
for(int i=0;i<TabCtrl_1.tabPageCount;i++)
TabCtrl_1.StretchTabPage(TabCtrl_1.hTab,i);
}
void CAuthenticationAddin::FormMain_OnClose(HWND hwnd)
{
PostQuitMessage(0);
TabControl_Destroy(&TabCtrl_1);
EndDialog(hwnd, 0);
}
void CAuthenticationAddin::InitHandles (HWND hwndParent)
{
BOOL initialized=FALSE;
if(!initialized)
{
if (frmMain != hwndParent) frmMain = hwndParent;
initialized=TRUE;
}
}
BOOL CAuthenticationAddin::FormMain_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
InitHandles (hwnd);
static LPSTR tabnames[]= {"Summit", "Risk", "Utility", "External Data", 0};
static LPSTR dlgnames[]= {MAKEINTRESOURCE(IDD_SB_DLG),
MAKEINTRESOURCE(IDD_RDB_DLG),
MAKEINTRESOURCE(IDD_UTILITY_DLG),
MAKEINTRESOURCE(IDD_EXTDATA_DLG),0};
New_TabControl( &TabCtrl_1,
GetDlgItem(hwnd, TAB_CONTROL_1),
tabnames,
dlgnames,
&AuthDialogProc,
NULL,
TRUE);
RECT rc;
GetWindowRect(hwnd,&rc);
gMinSize.cx = (rc.right - rc.left);
gMinSize.cy = (rc.bottom - rc.top);
return 0;
}
void CAuthenticationAddin::FormMain_OnCommand(HWND hWndDlg, int id, HWND hwndCtl, UINT codeNotify)
{
static bool warnOnSaveState = true;
static DisplayEnum rateDisplay = REAL_VAL;
static DisplayEnum spreadDisplay = REAL_VAL;
static bool keyFileState = false;
switch(id)
{
case IDOKSB:
case IDCANCELSB :
EndDialog(hWndDlg, IDCANCELSB);
EndDialog(GetParent(hWndDlg),IDCANCELSB);
break;
case IDOKRDB:
break;
case IDCANCELRDB :
break;
case IDC_TEST_BUTTON_RDB :
{
}
break;
case IDC_CHECK_KEYFILE :
{
}
break;
case IDC_RATE1 :
case IDC_RATE2 :
case IDC_RATE3 :
rateDisplay = RateDisplayFromButtonID(codeNotify);
CAuthenticationAddin::GetObject().SetRateDisplay(rateDisplay);
break;
case IDC_SPREAD1 :
case IDC_SPREAD2 :
case IDC_SPREAD3 :
case IDOKUTIL:
break;
case IDCANCELUTIL :
case IDC_TEST_BUTTON_UTIL :
{
}
break;
case IDOKED:
break;
case IDC_TEST_BUTTON_ED :
{
}
break;
case IDCANCELED :
case IDCANCEL :
}
}
BOOL CALLBACK CAuthenticationAddin::AuthDialogProc(
HWND hWndDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
try
{
switch(message)
{
HANDLE_MSG (hWndDlg, WM_COMMAND, FormMain_OnCommand);
HANDLE_MSG (hWndDlg, WM_INITDIALOG, FormMain_OnInitDialog);
HANDLE_MSG (hWndDlg, WM_SIZE, FormMain_OnSize);
HANDLE_MSG (hWndDlg, WM_NOTIFY, FormMain_OnNotify);
default:
return FALSE;
}
}
catch (CBaseException &e)
{
CAuthenticationAddin::GetObject().LoggedMessageBox(e, "AuthDialogProc");
}
catch(...)
{
CAuthenticationAddin::GetObject().LoggedMessageBox("Unexpected exception", "AuthDialogProc");
}
return TRUE;
}
VOID CAuthenticationAddin::TabPage_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, INT x, INT y, UINT keyFlags)
{
CAuthenticationAddin::ResetTabPageMessageLoop (hwnd);
}
VOID CAuthenticationAddin::SummitTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
if(CMD_VK_ESCAPE==id)
{
stopTabPageMessageLoop=TRUE;
SetFocus(m_lptc->hTab);
return;
}
else if(CMD_VK_RETURN==id)
{
}
if(codeNotify == EN_KILLFOCUS && id == IDC_CONFIG_SERVER_SB)
{
SetServerName(GetDlgItemString(hwnd, IDC_CONFIG_SERVER_SB));
}
.
.
.
ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
}
VOID CAuthenticationAddin::RiskTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
if(CMD_VK_ESCAPE==id)
{
stopTabPageMessageLoop=TRUE;
SetFocus(m_lptc->hTab);
return;
}
else if(CMD_VK_RETURN==id)
{
}
.
.
.
ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
}
VOID CAuthenticationAddin::UtilTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
if(CMD_VK_ESCAPE==id)
{
stopTabPageMessageLoop=TRUE;
SetFocus(m_lptc->hTab);
return;
}
else if(CMD_VK_RETURN==id)
{
}
.
.
.
ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
}
VOID CAuthenticationAddin::ExtTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
if(CMD_VK_ESCAPE==id)
{
stopTabPageMessageLoop=TRUE;
SetFocus(m_lptc->hTab);
return;
}
else if(CMD_VK_RETURN==id)
{
}
.
.
ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
}
VOID CAuthenticationAddin::ForwardWMCommand(HWND hwnd, INT id,HWND hwndCtl,UINT codeNotify)
{
FORWARD_WM_COMMAND (hwnd,id,hwndCtl,codeNotify,m_lptc->ParentProc);
if(codeNotify!=0) return;
ResetTabPageMessageLoop (hwnd);
SendMessage(hwnd , WM_NEXTDLGCTL, (WPARAM)0, FALSE);
SendMessage(hwnd , WM_NEXTDLGCTL, (WPARAM)1, FALSE);
}
BOOL CALLBACK CAuthenticationAddin::ConfigureSummitDialogProc(
HWND hWndDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
hWndSummit = hWndDlg;
try
{
static bool warnOnSaveState = true;
switch(message)
{
HANDLE_MSG (hWndDlg, WM_COMMAND, SummitTabPage_OnCommand);
HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
case WM_INITDIALOG:
{
SetDlgItemString(hWndDlg, IDC_SB_USER, username);
SetDlgItemString(hWndDlg, IDC_SB_PASS, password);
.
.
return DefWindowProc(hWndDlg, message, wParam, lParam);
}
break;
case WM_HELP :
CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);
break;
default:
return FALSE;
}
}
return TRUE;
}
BOOL CALLBACK CAuthenticationAddin::ConfigureRiskDialogProc(
HWND hWndDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
std::string d ="";
long rr=0;
try
{
static bool warnOnSaveState = true;
switch(message)
{
HANDLE_MSG (hWndDlg, WM_COMMAND, RiskTabPage_OnCommand);
HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
case WM_INITDIALOG:
{
.
.
.
return DefWindowProc(hWndDlg, message, wParam, lParam);
}
break;
case WM_HELP :
CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);
break;
default:
return FALSE;
}
}
return TRUE;
}
BOOL CALLBACK CAuthenticationAddin::ConfigureUtilDialogProc(
HWND hWndDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
try
{
static bool warnOnSaveState = true;
static DisplayEnum rateDisplay = REAL_VAL;
static DisplayEnum spreadDisplay = REAL_VAL;
static bool keyFileState = false;
switch(message)
{
HANDLE_MSG (hWndDlg, WM_COMMAND, UtilTabPage_OnCommand);
HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
case WM_INITDIALOG:
{
.
.
.
return DefWindowProc(hWndDlg, message, wParam, lParam);
}
break;
case WM_HELP :
CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);
break;
default:
return FALSE;
}
}
return TRUE;
}
BOOL CALLBACK CAuthenticationAddin::ConfigureExtDataDialogProc(
HWND hWndDlg,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
try
{
static bool warnOnSaveState = true;
switch(message)
{
HANDLE_MSG (hWndDlg, WM_COMMAND, ExtTabPage_OnCommand);
HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
case WM_INITDIALOG:
{
.
.
.
return DefWindowProc(hWndDlg, message, wParam, lParam);
}
break;
case WM_HELP :
CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);
break;
default:
return FALSE;
}
}
return TRUE;
}
|
|
|
|
|
Hi everyone, please help me to fix this problem.
I'm writing a function which must lock workstation(Windows Vista), so I use LockWorkStation() and it works fine. The problem is that after locking the focus must be on an account I want, not on that one from which I logged off. Can I specify that account somehow before calling LockWorkStation()?
Thanks in advance
|
|
|
|
|
What a relief to know there isn't a problem with LockWorkStation(). THANKS!
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
If you read my post more carefully, you could see that I didn't say that there is no problem with LockWorkStation() at all, I said that I haven't encounter a problem with it
|
|
|
|
|
Mike did read your post (perhaps you inadvertently asked the wrong question). He was politely telling you that if LockWorkStation() behaved as you wanted, imagine the security hole that would be created.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Welcome again, mike.[^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I m new in VC++ and also c++
I want to create a wrapper class. i want create wpcap.dll to API application.
and then that created dll is must referred to C# application.
Please help me
|
|
|
|
|
Please, can you read the guidelines[^] and rephrase your question?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|