|
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
|
|
|
|
|
Hello
You can try to make it using CHttpConnection with MFC. Or you can use API functions: WinHttpOpen , WinHttpConnect , WinHttpOpenRequest .
Andrew
|
|
|
|
|
hi, but can i use a socketlib instead? i need it for windows and linux!! i dont want to use OpenSSL because the docu ist bad!!
such a socket lib i search:
<br />
Socket *socket = new Socket();<br />
socket->connectSSL("google.com", 443);<br />
socket->sends("GET / HTTP/1.0\n\n");<br />
const char *response = socket->reads();<br />
cout << response;<br />
socket->close();<br />
cu+thx
|
|
|
|
|
The thread 0xE9C has exited with code 0 (0x0).
The thread 0x50C has exited with code -1073741819 (0xC0000005).
The program 'C:\Program Files\Microsoft Visual Studio\MyProjects\wordlist\Debug\wordlist.exe' has exited with code -1073741819 (0xC0000005).
can someone please tell me what that means i cant figure it out
|
|
|
|
|
I don't recognize 0xC0000005 as a Windows error code, but it is the number you see for an access violation exception. If that's the case, you've got a bad pointer value somewhere (using an uninitialized pointer, dereferencing NULL , using memory after it's freed, etc.).
Software Zen: delete this;
|
|
|
|
|
0xC0000005 is a windows error code!!!
To be precisely, it is an exception code (EXCEPTION_ACCESS_VIOLATION).
Don't try it, just do it!
|
|
|
|
|
Hey there.
Can someone provide me with a few examples of how to handle exceptions? Below is some code I used in an application. p->ShowWindow(SW_SHOW) is used to display a dialog containing an ActiveX Control. If the control is not registered I should get an exception, but it is not working. I must have something set up wrong. I have many places in my application where I need to do exception handling, thought I should start with this example.
Jerry
/////Not sure if I need these 2 lines of code???
#include <new>
using std::bad_alloc;
///////
try
{
p->ShowWindow(SW_SHOW);
}
catch(bad_alloc exception)
{
MessageBox("Data", "Memory Allocation Error", _OK);
}
//////
|
|
|
|
|
I left out: #include <new>
|
|
|
|
|
First off, you really should be catching exceptions by reference, as catching them by value will create two copies, instead of one.
That apart, IIRC, bad_alloc is thrown only when the new operator fails to allocate memory. AFAIK, the CRT that comes with VC++ doesn't do that, it instead returns NULL. Your code is most probably throwing some other exception. If you *really* want to catch all exceptions, your code should look like
try
{
...
}
catch(...)
{
}
This is not recommended though, I'd suggest figuring out the exact exception thrown and catching it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|