|
In your dialog class:
GetDlgItem(IDC_YOURBUTTON)->EnableWindow(bActive);
Hope this helps
|
|
|
|
|
thanks you
|
|
|
|
|
Hi everybody,
I would need your help...I have to create a rectangle on clicking LEFT-Button of the mouse and tracking it over the screen. I mean, the typical one that appears when you select, for instance, several icons on the desktop. I want to do this to get the coordenaes of the rectangle made by the user. How can I do it?
In this site :
http://www.codeguru.com/Cpp/G-M/gdi/article.php/c139/
It explains how to do it, the problem is that if you execute the application you will see that when you move the mouse to create the rectangle, the program doesn't erase the previous rectangle before tracking the mouse. How can I do to delete the previous rectangles? Or could you give a link to search for it?
Thanks,
Javi
|
|
|
|
|
This is usually done calling DrawFocusRect . Before drawing a rectangle with it, you first call it with the previous rectangle coordinates, which erases the last drawing.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
|
Hi All,
Can anyone help me how to make a VSC++(6.0) ActiveX Dll that will be calling VB.Net ActiveX Dll? Example I want to pass 2 parameter Strings to a C++ class/function with a value of "2" and "1". Inside the c++ dll, it will call the vb.net activeX dll that will sum the 2 nos. and will return 3 of float data type to the c++ dll.
your answer will be very much appreciated.
Thanks
|
|
|
|
|
how do you guys make a dialog window overlap everything? even games?
i understand the command
CDialog::SetWindowPos&wndTopMost,0,100,0,0,SWP_NOACTIVATE|SWP_NOSIZE);
but it does not overlap games
i have seen advertisers like netzero advertisements managed to overlap everything even games in full screen mode
SetWindowPos is insufficient in this case
what's is the easiest way to do this overlapping feat?
please advise
|
|
|
|
|
Will a system-modal dialog work?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
nope it doesnt
it's the same as the windowsetpos command above
|
|
|
|
|
problem code:
pMetaFileDC->SelectObject(newPen);
when debug, it causes an assertion. the source is:
{ ASSERT(m_hDC == m_hAttribDC); // ASSERT a simple CDC object
return (hObject != NULL) ? ::SelectObject(m_hDC, hObject) : NULL; }
ok, then i write this:
pDoc->pMetaFileDC->SetAttribDC(pDoc->pMetaFileDC->GetSafeHdc());
but this fuciton do not work as supposed. and the assertion remains.
look into the source code:
void CMetaFileDC::SetAttribDC(HDC hDC) // Set the Attribute DC
{
if (hDC != m_hDC)
CDC::SetAttribDC(hDC);
if (m_hDC == m_hAttribDC) // if we somehow got to this, correct it
ReleaseAttribDC();
}
i am really confused! what am i supposed to do?
in addition, if i do nothing but use the release vision, i find it works quite well without any problem.
reference this:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/_core_the_trace_macro.asp[^]
|
|
|
|
|
wrb302 wrote:
in addition, if i do nothing but use the release vision, i find it works quite well without any problem.
Wrong. The problem still exists. The reason you do not see it is because the ASSERT() macro has been removed by the preprocessor in Release mode.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
In my application I draw a property page, and hit a button on this property page to open a new dialog(which will close the property page). Now I want to show the property page on a button click from this new dialog. For which I have code in OnButtonBlickInThisNewDialog as
propSheetPtr->DoModal();
But the prop sheet is not showing up, instead seems like its being displayed for a fraction of a second and goes off. I checked the value of this propSheetPtr it is not deleted, i.e. prop sheet pointer still has the same values as it had when displayed earlier
Also tried
propSheetPtr->ShowWindow(SW_SHOW)
but the property sheet does not stay (displayed!)
Can anybody help me out for this issue?
Thanks.
|
|
|
|
|
I am about to implement a windows background service.
I have succeeded to build the basic functions such as creating, stopping and deleting the service.
The service is actually built basing on an infinite while loop (while(1)),
if i put some simply operation like file processing in the while loop, it works fine~
when i put this line "doc. getdocumentlist(doclist, 9);" in, the program just stops there and cannot proceed to the codes below( this can be seen from the log file content).
Can anybody explain this to me...
void cService::EndlessLoop()<br />
{<br />
Output("EndlessLoop Start\n");<br />
SYSTEMTIME Clock;<br />
CString Out;<br />
Cdocumentdb doc;<br />
while (1)<br />
{<br />
if (hTimer != 0)<br />
{<br />
LARGE_INTEGER Elapse;<br />
Elapse.QuadPart = -10000000;
BOOL Res = ::SetWaitableTimer(hTimer, &Elapse, 0, 0, 0, TRUE);<br />
<br />
if (Res)<br />
{<br />
DWORD Event = WaitForSingleObject(hTimer, 30000);
}<br />
}<br />
CArray<CString, CString> doclist;<br />
<br />
doc. getdocumentlist(doclist, 9);<br />
<br />
::GetLocalTime(&Clock);<br />
Out.Format("Timer %02d:%02d:%02d:%03d", Clock.wHour, Clock.wMinute, Clock.wSecond, Clock.wMilliseconds);<br />
Output(Out);<br />
};<br />
}
|
|
|
|
|
sorry, forgot to say,
what the "doc. getdocumentlist(doclist, 9);" is to retrieve some information from a database table...
|
|
|
|
|
Does your code work when it is NOT placed into a service?
If that is true, then it could be a permissions issue.
You might need to make sure the service runs under an account that has the proper privileges and security to access the database.
|
|
|
|
|
Hi,
I have the following code written for a target compiler (Keil compiler) which uses 16 bits:
-----------------------
signed short int a, b, c;
a = (b + c) / 2;
-------------------------
With the inputs for b = 30720, c = 30720,
i) when VC++ compiler is used, the value of a is evaluated as 30720.
ii) However, when using the Keil compiler, the value of a is evaluated as -2048. This is due to the fact that the calculated value of (b + c) is 61440 and as this value lies above the valid range of signed short int, it gets wrapped to -4096 before division by 2. This value after division becomes -2048.
Now my concern is that if there exists any settings in VC++ compiler environment so that I get the same value for the variable 'a' as that of Keil environment. An early response would be appreciated.
|
|
|
|
|
A signed short int is the same as a __int16 type in VC++. The range is –32,768 to 32,767. For the VC++ compiler to produce the correct result, it looks like it is promoting (b + c) to a signed int first so that it does not overflow.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
Does anyone know if it is possible to get notification from Windows in the
event of change of CPU frequency driven by Enhanced SpeedStep technology?
It would be nice to hook a callback function to the event so that I would
know at any time what CPU frequency my laptop is running at.
Vitaly Kashkarov
|
|
|
|
|
I am having problems getting SetVolume to change the volume of my sound buffers.
When my program starts it scrolls though a database that holds the filename, pan, and volume settings for each sound, loads these sounds in secondary buffers, and then sets the pan and volume for each individual sound. Several sounds will be loaded at once.
Once the sounds are loaded the pan and volume can be changed with slider controls and drop lists. Both of which work correctly. My problem is on program init.
When the program starts, the position of the slider control for the volume gets set to the correct position (0-100% volume), but the volume is always played at 100%. The pan on the other hand always works correctly and the sound is played on the correct left or right speaker.
I think that SetVolume is working however, because if I change the pan without changing the volume slider, the volume changes to what it should have been.
Any ideas?
Mark Keeling
|
|
|
|
|
|
This is for the most part, the area of the program I am dealing with. The part that I am concerned with is the last function of UpdateVolumeSettings(). The rest seems to work correctly, as I am able to adjust the volume with the slider control.
Thanks for any help!
Mark Keeling
void CHalloweenView::OnInitialUpdate()
{
m_pSet = &GetDocument()->m_halloweenSet;
CRecordView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
// Set the range of the volume control.
m_ctlVolume.SetRangeMax(100);
m_ctlVolume.SetRangeMin(0);
// Count the number of database entries.
CountDataBaseEntries();
// Connect to the PLC through RSLinx DDE, this is what triggers the sound to play.
StartPLCComms();
// Initialize the DirectSound Objects. And load all the sounds into buffers.
InitDirectSound();
// Update the volume settings for each sound.
UpdateVolumeSettings();
// Update the pan settings for each sound.
UpdatePanSettings();
// Initialize the record number for display.
m_nRecordNumber = 1;
m_strSoundNumber.Format("Sound 1 of %d", m_pSet->GetRecordCount());
// Load the data from the first record into the display.
RefreshDisplayValues();
// Create the timer used to trigger the sound effects from the PLC.
SetTimer(1, 500, NULL);
// Start the welcome sound (Sound #1) on card #1.
sound_fx[0][0].dsbuffer->Play(0,0,0);
UpdateData(FALSE);
}
void CHalloweenView::SetSoundVolume(int nSound, long lVolume)
{
// Loop once for each sound card detected.
for (int nIndex = 0; nIndex < nNumberOfSoundDevices; nIndex++)
{
// If the sound_fx buffer was created (ie. sound file exists).
if (sound_fx[nIndex][nSound].dsbuffer != NULL)
// Change the volume of the sound.
if (sound_fx[nIndex][nSound].dsbuffer->SetVolume(lVolume) != DS_OK)
MessageBox("Can not set volume!");
}
}
void CHalloweenView::OnReleasedcaptureSliderVolume(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
long lVolume;
// Return to the position in the database that the display is currently showing.
m_pSet->MoveFirst();
m_pSet->Move(m_nRecordNumber - 1);
// Save the changes to the database.
m_pSet->Edit();
m_pSet->m_Volume = m_ctlVolume.GetPos();
m_pSet->Update();
// Set the volume of the sound.
lVolume = m_pSet->m_Volume * 30 - 3000;
SetSoundVolume(m_nRecordNumber, lVolume);
*pResult = 0;
}
void CHalloweenView::UpdateVolumeSettings()
{
long lVolume = 0;
// Make sure to start at the first database record.
m_pSet->MoveFirst();
// Set the volume for each sound that was loaded from the database records.
for (int nSound = 1; nSound <= m_pSet->GetRecordCount(); nSound ++)
{
// Volume settings.
lVolume = m_pSet->m_Volume * 30 - 3000;
SetSoundVolume(nSound, lVolume);
// Move to the next databse entry,
m_pSet->MoveNext();
}
// Move back to the first database entry.
m_pSet->MoveFirst();
}
|
|
|
|
|
zwzcode wrote:
pRst->Fields->Item[0L]->Value=100L; //But it throw a excpetion here. I dont know the reason. If I alter the datatype of ID to CHAR(10) ,it is all right.
Well, the answer is obvious, isn't it ? The value needs to be a string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am trying to put a button on the main window of a simple SDI project. The button appears ok but it doesn't respond to the mouse. I am declaring the button in the CMainFrame class and creating it in OnCreate (see below). The same code works fine for a dialog but not for the main window.
class CMainFrame : public CFrameWnd
{
...
CButton m_wndPushButton;
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
m_wndPushButton.Create(_T("test"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rect, this, 1);
Any pointers would be appreciated.
Thanks,
Scott
|
|
|
|
|
shfinfrock wrote:
I am trying to put a button on the main window of a simple SDI project. The button appears ok but it doesn't respond to the mouse. I am declaring the button in the CMainFrame class and creating it in OnCreate (see below). The same code works fine for a dialog but not for the main window.
[...]
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
m_wndPushButton.Create(_T("test"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rect, this, 1);
In an SDI app, you'll always have a CView covering the entire client area. You see the button in the screen, because the view is painted before the button. However, the button is actually behind the view in the z-order, so it's not receiving any mouse message.
If you add the WS_CLIPSIBLINGS style to the button, you won't even see it. If you add the following line after the button creation, you'll see it and it will start receiving (and reacting to) mouse messages:
m_wndPushButton.SetWindowPos(&wndTop, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
However, you should note this button will actually overlap with the view, obscuring some part of it. I'm not sure if that's what you want... Consider placing the button in a toolbar or dialog bar so that it doesn't overlap with the view.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
hi!
how can i send a GET, POST request to a HTTPS server?
is it easy to do that with c# und System.Web Namespace?
do anybody know the cURL lib? http://curl.haxx.se/
ps.: i want to do that to do that as easy as possible!
cu+thx
|
|
|
|
|