|
can anyone help me
thnks in advance
|
|
|
|
|
hellogany wrote: I was earlier using vc++6.0 now changed to VS2005.Is there any difference in usign vc++ between thse two..?
What happens when you try it?
|
|
|
|
|
Hi Members,
I wanted to know if it i possible to protect a folder using Visual C++ such that it asks for a password when we rename, cut, copy, move or drag and drop and cd to the directory from command prompt.
Thanks,
Raj
|
|
|
|
|
See documentation [^].
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]
|
|
|
|
|
how to show static control on picture control in dialog box in picture control i use bitmap but when run it never shows static control on picture control. can anyone tell me how to show static control on picture control
Project Engineer
|
|
|
|
|
Do you think the static control is below the picture control.
If so you can use BringWindowToTop or SetForegroundWindow to bring the static control on top of the picture control.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I have context menu on dialog box now i want to set background color of context menu.please anyone can tell me how to set background color of menu and context menu as well as submenu.
Project Engineer
|
|
|
|
|
Hi,
i tried using
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
ON_WM_NCCALCSIZE()
END_MESSAGE_MAP()
void CMyDlg::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp)
{
CRect& rc = (CRect&)lpncsp->rgrc[0];
rc.top += 20; // Increase the height of tittle bar
CWnd::OnNcCalcSize(bCalcValidRects, lpncsp);
}
but the issue is when i run the exe in which i used the above code it works in one system(ie clientarea for the dialog is decreased) but in other system client area was not decreased....
Please try to help me out....
|
|
|
|
|
Is there any way I can tell windows not to update my layered window when the window below the layered window is updated. Right now, it is causing lot of flickering in the layered window. I want to somehow control the updating of layered window.
Please suggest.
|
|
|
|
|
Hi friends
I have a bunch of resources name store in a file and i load these resources name in string
CString strRes = "IDC_LIST";
Can i use like this
GetDlgItem( strRes )->ShowWindow( SW_SHOW );
thanks in advance
-kk.tvm-
|
|
|
|
|
no it is not possiable bcoz GetDlgItem do not have string type of parameter. You need to mapping with string with resource.
|
|
|
|
|
The resource name (IDC_LIST) is actually an integer value which is #defined.
So you cannot use it like a string ("IDC_LIST").
If look at the signature of the GetDlgItem method[^], the parameter to the function is an integer value.
So you should be storing the integer values in the file rather than the names.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Sir,
I am Venkatraman working in HCL and I read your article (Undelete a file in NTFS) on 09/10/2009 and I am having a doubt in it my question is this "what are u trying to explain in attribute field in UnDelete.cpp file and what is the actual process of the atrribute field in the Undelete window"
Waiting for your reply
|
|
|
|
|
You need to post your question on the article page.
|
|
|
|
|
Go to the page Undelete a file in NTFS[^], scroll to the bottom and click New Message to post your question.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi there,
I have an application that uses UDP socket to exchange packets with some mobile devices (we have modem and SIM cards in these devices and use UDP socket to connect to the C++ application). the application also has a TCS socket that connects to a server that connects to the same mobile device through radio system. Here we try to send some messages to the devices using GPRS and if it failed to go out (no ACK was sent from the device) we retransmit message through radio. my question is that I need to know if the GPRS system is down or not and if it is down I do not try GPRS first and wait for ACK to come back (delay in messaging). please note that we have heart beat from devices to the application every 45 minutes so I can't use heartbeat as an indicator of GPRS being down. also in slow time of the day (midnight to 5:00 am there is not much trafic between the devices and application. what is the best way here to decide if GPRS is down?
Thanks for help,
Nahitan
|
|
|
|
|
I do not understand what you just said (design/implementation/cost problem?). If you do not have a kind of connectivity status, then add one by implementing a reasonable fast heartbeat.
Cheers
|
|
|
|
|
Thanks for your reply, I might not explained it properly but having all the devices send fast heartbeat means a lot of data traffic and pay for that and when you have like 1000 device and want to pay more than 5M per month or something like $15/month for GPRS usage is not acceptable by customers. so fast heartbeat is not a solution. I was/ am looking for a better way of examining the healthiness of the GPRS data trafic through UDP socket. Thanks for ideas in advanced.
Nahitan
|
|
|
|
|
Ok, sounds like a design or cost problem.
Unfortunately, I see no other technical solution than the one mentioned before. The concept of a heartbeat is more or less the same regardless of using UDP or TCP. If peer A wants to know about the status/availability of peer B, it either has to receive a "message" from B in regular intervals (and therfor knows that peer B is alive) -or- when there is no regular traffic to piggyback the heartbeat then one of the peers has to initiate (additional) heartbeats in reasonable intervals. For example an IRC server uses regular ping/pong messages every few minutes to find out about the connection status of its chat clients.
Regarding the costs, at the end of the day a better service will cause more traffic. You could offer your customers maybe a cheap basic service and an advanced service with more features.
Hope this helps
/M
|
|
|
|
|
I am having trouble getting tooltips right for CTabCtrl when it has enough tabs that the spinner is up to scroll through the tabs.
If I use CTabCtrl::SetToolTips(), then a tab's tooltip stays with it, even when the tabs scroll (good). The problem is that it seems to take my tool ID (1, 2, ... N) as an index into the tabs -- and zero is not a valid ID (asserts in MFC), so I cannot have a tooltip for the first tab.
Alternatively, I can do the tooltips on my own -- the problem there is that I do not know how to tell when the tabs scroll so I can update the tooltip control's rects. WM_HSCROLL works for the spinner, but not if the scrolling happened because of a right- or left-arrow key.
I could set to supply the tooltip text each time, and on each request compare the cursor postion to the tab rect's, but that seems like a heavyweight kludge. (I could also go to multi-line tabs, but do not want to do that.)
So, what is the correct way to do it?
TIA,
Bob
modified on Sunday, September 13, 2009 3:41 PM
|
|
|
|
|
I am using a CListCtrl control in may application, where i have 10 iteams in that control.
Now after receiving some input from user , i need to select a particular item from that list.
I have a code where after receiving users input , i am calling myCtrl.SetItemState( itemID, LVIS_SELECTED, LVIS_SELECTED ); to select respective item from that ctrl.
Now it is observed that after executing above line of code, afx_msg void OnSelchanged( NMHDR* pNMHDR, LRESULT* pResult ) is getting called multiple times.
Also when i tried to retrieve selected item in OnSelchanged method , by using ( GetFirstSelectedItemPosition() and GetNextSelectedItem() ), it gives different output every time.
Can you please explain,
i) why this OnSelchanged() method is getting called multiple times whenever myCtrl.SetItemState( itemID, LVIS_SELECTED, LVIS_SELECTED );line of code gets executed.
ii) Why i am getting different output ( id of item selected) after executing GetFirstSelectedItemPosition() and GetNextSelectedItem().
|
|
|
|
|
Member 4253145 wrote: Can you please explain,
i) why this OnSelchanged() method is getting called multiple times whenever myCtrl.SetItemState( itemID, LVIS_SELECTED, LVIS_SELECTED );line of code gets executed.
Because the state of more than one item is being changed.
"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
|
|
|
|
|
When you select an item in the list control, the previously selected item is deselected.
The OnSelChanged will be called twice here, once when the previous item is deselected and then when the new item is selected. This is what David mentioned in his reply.
It is not a good idea to call functions like GetFirstSelectedItemPosition and GetNextSelectedItem inside the OnSelChanged handler.
In-fact you don't need to.
It is already given to you in the NMLISTVIEW parameter of the handler.
You need to check the state of the uNewState member.
if (LVIS_SELECTED & pNMLV->uNewState)
If the above condition is true, you can get the selected item in the iItem member.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I'm developing an application that allows the user to create a bitmap from portions of "n" other source bitmaps. For example, starting with three bitmaps (A, B, and C), the user could select the top third of A, the middle third of B and the bottom third of C and create destination bitmap D.
What I'd like to do is create a window that shows one of bitmap A, B, C.... (and has a dialog bar allowing selection of which one). A, B, and C are fully formed, that is, all pixels are defined. Bitmap D is undefined, that is, all pixels are (by default) white. I'd like to display D as a translucent bitmap on top of the selected source bitmap. It the user left-click+moves the mouse over the pair of bitmaps the pixels on A are copied up into D.
Once all desired pixels of A are copied upto D, the user would change A to B, D would now be displayed on top of B and the user could copied pixels from B upto D. And so on for all source bitmaps.
The undefined parts of D (ie the white pixels) I'd like to show as a "gray film", and the cursor would then be an "eraser" ie remove the "film" and allows the underlying bitmap to shine through.
In theory this is all fairly easy. BUT, I'm stymied on the simple part of how do I create and display the translucent bitmap D?
Attempts so far are:
1. create aDC_ with aBitmap_
2. create dDC_ with dBitmap_
3. create memDC_ with memBitmap_
4. memDC_->BitBlt(..., aDC_..., SRCCOPY)
5. memDC_->BitBlt(..., dDC_, ..., ?) <=== this is the translucent bitmap
6. pDC->BitBlt(..., memDC_..., SRCCOPY);
The question is how do a setup the DC_'s to get the translucency to work?
Any help is much appreciated!
Regards,
Kylur.
|
|
|
|
|
here's the classic MSDN version:
BOOL DrawTransparentBitmap(HDC hdc,
HBITMAP hBitmap,
__int32 xStart,
__int32 yStart,
COLORREF cTransparentColor)
{
BITMAP bm;
COLORREF cColor;
HBITMAP bmAndBack, bmAndObject, bmAndMem, bmSave;
HBITMAP bmBackOld, bmObjectOld, bmMemOld, bmSaveOld, bmTempOld;
HDC hdcMem, hdcBack, hdcObject, hdcTemp, hdcSave;
POINT ptSize;
int iCaps = ::GetDeviceCaps(hdc, RASTERCAPS);
if ((iCaps & RC_BITBLT) != RC_BITBLT)
{
return FALSE;
}
if ((iCaps & RC_BITMAP64) != RC_BITMAP64)
{
return FALSE;
}
hdcTemp = CreateCompatibleDC(hdc);
if (hdcTemp==NULL)
{
return FALSE;
}
bmTempOld = (HBITMAP)SelectObject(hdcTemp, hBitmap);
if (GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm) != sizeof(BITMAP))
{
DeleteDC(hdcTemp);
return FALSE;
}
ptSize.x = bm.bmWidth;
ptSize.y = bm.bmHeight;
DPtoLP(hdcTemp, &ptSize, 1);
hdcBack = CreateCompatibleDC(hdc);
hdcObject = CreateCompatibleDC(hdc);
hdcMem = CreateCompatibleDC(hdc);
hdcSave = CreateCompatibleDC(hdc);
bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndMem = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmSave = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmBackOld = (HBITMAP)SelectObject(hdcBack, bmAndBack);
bmObjectOld = (HBITMAP)SelectObject(hdcObject, bmAndObject);
bmMemOld = (HBITMAP)SelectObject(hdcMem, bmAndMem);
bmSaveOld = (HBITMAP)SelectObject(hdcSave, bmSave);
SetMapMode(hdcTemp, GetMapMode(hdc));
BitBlt(hdcSave, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);
cColor = SetBkColor(hdcTemp, cTransparentColor);
BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0,
SRCCOPY);
SetBkColor(hdcTemp, cColor);
BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdc, xStart, yStart, SRCCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
BitBlt(hdc, xStart, yStart, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcSave, 0, 0, SRCCOPY);
DeleteObject(SelectObject(hdcBack, bmBackOld));
DeleteObject(SelectObject(hdcObject, bmObjectOld));
DeleteObject(SelectObject(hdcMem, bmMemOld));
DeleteObject(SelectObject(hdcSave, bmSaveOld));
SelectObject(hdcTemp, bmTempOld);
DeleteDC(hdcMem);
DeleteDC(hdcBack);
DeleteDC(hdcObject);
DeleteDC(hdcSave);
DeleteDC(hdcTemp);
return TRUE;
}
|
|
|
|
|