|
How do I change the font style of the text in CView to the font style selected from the fontdialog?
|
|
|
|
|
LOGFONT newlf;
CFontDialog fd;
if(fd.DoModal() == IDOK)
{
fd.GetCurrentFont(&newlf);
setfont(newlf);
UpdateData(FALSE);
}
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
Thanks. I have used this method, font style of the text is changed but the alignment of the text is not proper. How do I ensure that the text alignment isn't changed?
|
|
|
|
|
Hi,
You can change the alignment using SetTextAlign();
pDCMem->SetTextAlign (TA_BASELINE);
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
i want to change background color of group box caption
in OnCtrlColor method i can change color of caption of groupbox but i want to change background color of groupbox caption
how is that possible?
|
|
|
|
|
Call pDC->SetBkColor(); also OnCtrlColor() function should return the brush with that color.
|
|
|
|
|
|
Who must be see this link? Naveen or anilaabc?
|
|
|
|
|
Alok
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Hi all,
I got this error:
Windows has triggered a breakpoint in UpdateService.exe.
This may be due to a corruption of the heap, and indicates a bug in UpdateService.exe
or any of the DLLs it has loaded.
The output window may have more diagnostic information.
and this is my code:
USES_CONVERSION;
pDoCheckForProductUpdates->productName = new std::string(W2A(prd->m_Name.c_str()));
pDoCheckForProductUpdates->productVersion = new std::string(W2A(prd->m_VersionNo.c_str()));
pDoCheckForProductUpdates->serialNumber = new std::string(W2A(prd->m_SerialNo.c_str()));
pDoCheckForProductUpdates->siteCode = new std::string(W2A(prd->m_SiteCode.c_str()));
_ns1__DoGetLatestProduct *pDoGetLatestProduct;
_ns1__DoGetLatestProductResponse *pDoGetLatestProductResponse;
pDoGetLatestProduct = InstantiateGetProduct();
pDoGetLatestProductResponse = InstantiateGetProductResponse();
iRet = m_pWebServiceSoap->__ns2__DoCheckForProductUpdates(pDoCheckForProductUpdates,pDoCheckForProductUpdatesResponse);
The error happens at the bold part. going to this part of atlsimpstr.h
#if _SECURE_ATL
CopyChars( PXSTR( pNewData->data() ), nCharsToCopy,
PCXSTR( pOldData->data() ), nCharsToCopy );
#else
CopyChars( PXSTR( pNewData->data() ), PCXSTR( pOldData->data() ), nCharsToCopy );
#endif
pNewData->nDataLength = nOldLength;
pOldData->Release();
Attach( pNewData );
}
Whats wrong with my code?
This error doesnt happen before but when i used "Use Standard Windows Libraries" but due to certain changes i encountered this error: fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
Now i used Use MFC in a Shared DLL to solve that error now i encounter the above error.
Thanks,
Jayjay
modified on Wednesday, September 24, 2008 10:43 PM
|
|
|
|
|
Has anyone used this API in light of the scant MSDN documentation?
CShareLockNH Methods: A group of methods that is used to manipulate locks.
Methods:The following are methods exported by Rwnh.dll. ...
I could not find a header file, and the API does not make much sense.
Is it a single lock for the entire application? I see the descriptions of API functions are not accepting much as input or output. No trace of the object 'CShareLockNH' in the VS 2003 header files.
|
|
|
|
|
Interesting! I've never heard of those functions.
There's not any documentation I can find...is it some kernel mode
stuff maybe part of the DDK?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It seems to be related to IIS being installed, and so many people have not tried to use them, at least as my Google search revealed. I did not find anything claiming to know how to use them, only where they came from - IIS - and that they are largely undocumented.
I was searching for a reader/writer lock that was C/C++ and fairly performant - hoped one was at some point part of the SDK - that is how I stumbled upon it in the MSDN.
|
|
|
|
|
Maybe a dumb question, but I was just curious -- are heap-allocated objects in C++ destroyed when a program is exited even if they aren't explicitly freed with calls to delete or free?
Thanks!
KR
|
|
|
|
|
Yes - all the memory your process used is returned to the system.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
To be more specific; the heap is destroyed, but the destructor is not called for objects. A non-issue the vast majority of the time (handles will also be closed) but there may be a rare circumstance where a resource needs to be closed a more complex way. (This is rare enough that I can't even think of a non-contrived example.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: o be more specific; the heap is destroyed, but the destructor is not called for objects.
Good point!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually, a non-contrived answer was staring me in the face: a file class that caches writes.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I have searched everywhere,but I cant find any simple examples of using libtorrent on windows.
If someone could give simple example of using it, for example downloading torrent C:\torrent.torrent and seeding it, I would be very thankful
Just something that could help me understand how to use that library!
No flaming , Im new with c++
|
|
|
|
|
Hello,
This is my first attempt at using threads so go easy. Could some one look at the code below and tell me if I'm going to run into trouble if I keep calling this function i.e. loss of memory.
The reason why I'm trying to use a Thread is this: we are writing .dll files to add functionality to a scripting language which is used in a software. The problem is that when a c++ function is called from a .dll file from within this scripting language the next line of code (in the script) doesn't get called until the .dll's function has returned. I was thinking that I could use a thread to get around this problem.
Does this make sense? or is there another way of doing it?
Thanks
#include <iostream>
#include <windows.h>
using namespace std;
typedef struct PulseData {
int iData1;
int iData2;
} DATA, *PDATA;
DWORD WINAPI TestFunction(LPVOID lpParam){
PDATA pPassedData = (PDATA)lpParam;
Sleep(1);
cout << pPassedData->iData1 << endl;
cout << pPassedData->iData2 << endl;
Sleep(1);
return 0;
}
int main(){
PDATA pPulseData[1];
DWORD dwThread[1];
HANDLE hThread[1];
pPulseData[0] = (PDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DATA));
pPulseData[0]->iData1 = 100;
pPulseData[0]->iData2 = 200;
cout << "creating thread" << endl;
hThread[0] = CreateThread(NULL, 0,TestFunction, pPulseData, 0, &dwThread[0]);
cout << "thread finished" << endl;
system("PAUSE");
return 0;
}
</windows.h></iostream>
p.s. the includes are:
#include <iostream>
#include <windows.h>
I don't know why they don't show up in the code
|
|
|
|
|
Ylno wrote: p.s. the includes are:
#include
#include
I don't know why they don't show up in the code
I assume you want the < and > characters around your include files. They don't show up because putting the characters in explicitly makes the browser treat them as an HTML tag. Use < for the < symbol and > for the > symbol.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
Ylno wrote: pPulseData[0] = (PDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DATA));
Why HeapAlloc and not "new"?
Ylno wrote: cout << "thread finished" << endl;
Wrong! You started a thread but when that line is reached you have no
idea if the thread has ended yet or not.
Besides the memory leak, I don't see any problems in the simple code shown.
You should assume all threads run in parallel - at the same time.
You can make no assumptions about when a thread ends relative to another
thread. It is up to you to synchronize threads where necessary and also
synchronize access to data used by multiple concurrently running threads.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Sorry. I was just writing "thread finished" as a test in the program. I should have written "thread called" or something similar. I just wanted to see if the thread would work independantly of the main program/thread.
You say that you don't see anything wrong with the code. Do that mean that when a thread finished that it reallocates any memory from on the heap as free to use memory?
Also you said << Why HeapAlloc and not "new"? >>. Why do you mean?
thanks for your reply,
Y
|
|
|
|
|
Ylno wrote: Do that mean that when a thread finished that it reallocates any memory from on the heap as free to use memory?
No, I said there's a memory leak. I don't see any HeapFree() call
releasing the memory.
Ylno wrote: you said << Why HeapAlloc and not "new"? >>. Why do you mean?
I'm just curious why you're directly calling Win32 memory management
functions instead of using the C++ "new" operator.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
I will put a heap free call in. Thanks.
|
|
|
|