|
there's some licensing you can do - for example, the MSHFlexGrid (in Visual Studio etc) is a licensed control - there is a special procedure that must be gone through to use it on a machine that does not have VB or Visual Studio installed. I don't know how to license a control, but I do have experience with this particular control and the hoops we had to do to get it to work. (on a pc that had not had the licensing procedure run, it displays as a blank box)
|
|
|
|
|
thanks - I did look at licensing but I couldn't see how it would stop anyone from using the control x-domains - I eventually implemented something via IObjectWithSite - to get the URL that the control was working under and then check to see if the url domain was one I allow access to
Holy Handgrenade of Antioch instructions
|
|
|
|
|
Hi.
My program needs a block of binary data to work. I do not want this binary data in a separate file because it is a) unchanging and b) i want minimal dependancies.
I've created a custom resource in resource editor and put my binary data in there.
I want to get a (BYTE *) pointer to this data at run time. The only method i've found of doing that up to now is this:
BYTE *p_SREData;
HGLOBAL hGlobal; HRSRC hRSrc;
hRSrc=FindResource(NULL, MAKEINTRESOURCE(IDR_DATA1),RT_RCDATA);
hGlobal=LoadResource(NULL, hRSrc);
p_SREData=(BYTE *) LockResource(hGlobal);
Whilst this works, surely there's a better, simpler way of getting the data?
And MSDN for LockResource states that the system frees allocated memory upon program termination, but you can free the memory manually when you no longer need it by calling one of the functions. But it's not obvious which function to use for a custom binary resource. Any ideas?
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Actually there is a faster way to do this. If you define your custom resource as for example
a "BINARY" data (Insert Resource->Custom (button) ->"BINARY" without quotes).
I always defined custom resource as binary anyway but give it the name you want...
Fastest way to get the data in my opinion is this:
// LPCTSTR lpszName = MAKEINTRESOURCE( idr_your_resource_id );
// LPCTSTR lpszType = _T("BINARY");
// HINSTANCE hRes = AfxGetResourceHandle();
BYTE* GetResourceData(LPCTSTR lpszName, LPCTSTR lpszType, HINSTANCE hRes)
{
HRSRC res = ::FindResource(hRes, lpszName, lpszType);
ASSERT( res != NULL);
BYTE* pBytes = (BYTE*) LockResource(LoadResource(hRes, res ));
ASSERT( pBytes != NULL);
return pBytes;
}
|
|
|
|
|
Hello everybody!
I have a little problem, help me please!
1. I'm create the listbox with multi-column style
2. I'm set the Width of ListBox (SetColumnWidth )
How can I add string to the second column, third column and etc?
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
You should use:
BOOL SetItem( int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem, int nImage, UINT nState, UINT nStateMask, LPARAM lParam );
The nItem is the line and the nSubItem is the column:
SetItem(102,2,0,"Second Colum",0,0,0,0);
|
|
|
|
|
But SetItem method is a member of the CListCtrl class and not member CListBox.
I want made multi-column from CListBox!
Sonork ID 100.10002:Yaumen
|
|
|
|
|
You can't! use CListCtrl. CListBox has less features than CListCtrl but
a CListCtrl is a bit harder to use.
|
|
|
|
|
Thank you for all!
Sonork ID 100.10002:Yaumen
|
|
|
|
|
Hi -
VC6 NT4 and Win98
I'm having a problem where TrackPopupMenu() fails and ERR is 0. I make the call inside a worker thread. Why does it fail there with no error? I read somewhere that TrackPopupMenu has its own message pump. Is this true?
Here's some code:
//
// this method works.
// TrackPopupMenu returns 1 and the menu is displayed.
//
void CTestMenusDlg::OnButton1()
{
CMenu *pMenu = new CMenu();
VERIFY(pMenu->CreatePopupMenu());
VERIFY(pMenu->AppendMenu(MF_STRING | MF_ENABLED, 32001, "Test1"));
VERIFY(pMenu->AppendMenu(MF_STRING | MF_ENABLED, 32002, "Test2"));
BOOL bOK = ::TrackPopupMenu(pMenu->m_hMenu,
TPM_LEFTALIGN |TPM_RIGHTBUTTON,
300, 300, 0, this->m_hWnd, NULL);
}
//
// this method will start a thread
//
void CTestMenusDlg::OnButton2()
{
CWinThread *pThread = AfxBeginThread(
PipeThread, this, 0,THREAD_PRIORITY_NORMAL,0,NULL);
}
//
// Runs same code as button1.
// TrackPopupMenu returns 0 and ERR is 0
//
UINT PipeThread(LPVOID lpvParams)
{
ASSERT( NULL != lpvParams );
CTestMenusDlg *pDlg = reinterpret_cast<CTestMenusDlg *>( lpvParams );
CMenu *pMenu = new CMenu();
VERIFY(pMenu->CreatePopupMenu());
VERIFY(pMenu->AppendMenu(MF_STRING | MF_ENABLED, 32001, "Test1"));
VERIFY(pMenu->AppendMenu(MF_STRING | MF_ENABLED, 32002, "Test2"));
BOOL bOK = ::TrackPopupMenu(pMenu->m_hMenu,
TPM_LEFTALIGN | TPM_RIGHTBUTTON,
300, 300, 0, pDlg->m_hWnd, NULL);
DWORD dwErr = ::GetLastError();
return 0;
}
|
|
|
|
|
I have a question:
Why you want to create a popup menu from a worker thread?
|
|
|
|
|
>> Why you want to create a popup menu from a worker thread?
Actually my real code does the opposite of my example. A worker thread gets sent a menu hierarchy via CORBA, creates a bunch of HMENUs and stores them in a table. Later on, when an item in a view is right-clicked, I look up the appropriate HMENU and create a popup.
When I started to debug this thing, I was sure that it was a threading issue and I thought that I couldn't share HMENUs across threads. I wrote a TestMenu app to check this theory out and I somehow flipped it so that the popups were being created inside the worker thread.
I've solved my problem though - a coding error in the worker thread was creating empty menus. Good HMENUs, but just no items. Still, in this instance and in my example code, when TrackPopupMenu was failing, it returns 0 and GetLastError is 0.
If TrackPopupMenu has its own message pump (as someone wrote in another post) and I pass a valid hWnd to TrackPopupMenu, why would it matter though if I called it from a non-UI (worker) thread?
thanks
|
|
|
|
|
Hi All,
We are having a requirement in which we need to calculate sunrise and sunset time depending on latitude, longitude and time zone. It would be of great help if you could suggest us any alogrithm to calculate the sunrise and sunset times.
Thanks
Prashanth
|
|
|
|
|
|
Hello!!
I will develope the multithread Syslog Server !!
But, I am novice for MFC!!
Can you say the sample code for UDP server using AsyncSocket?
Thanks in advanced!!
Bye..
|
|
|
|
|
How could I find out which NIC a NT4.0 workstation is using?
The program will be ran on the workstation.
|
|
|
|
|
If you're only interested in the IP addresses, check Warren Young's Winsock Programmer's FAQ example Getting the Local IP Address. If you're looking for more comprehensive information about the NICs, then SNMP is the way to go, and you might find it interesting having a look at Lee Hamel's article Retrieving NIC information using SNMP queries.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have one vc++ application.In that i have taken exe and i made a cab file.One .ocx control is present this ocx calls the exe file.I placed the cab file in net,so whenever a user clicks one link then the cab file is calling.So that my exe file is executing.Actually my ocx component is having the virisign registration.So,my component is providing some security to the user sytem.For security purpose it is showing one dialog box that is showing this message.
"Warning:The authority of this content can't be verified,therefore it can't be trusted.
Problem Listed below
The test root has not been enabled as a trusted root.Do you want to install and run the "abc" signed on 2001-12-11,....etc."
My Doubt:Even though i have registered ocx component,but it is showing this type of dialog box like the authority of this content can't be verified.
So,is it problem of creation of cab file.So,how can i solve my problem.So that i can supply trusted software to all endusers.
Can anybody help me in this case.
it is a company which deals with AI and different
types of web based applications
|
|
|
|
|
In my MFC application I had to create a static callback member function. The function works ok, but now I need to declare a static data member.
So I added a static member like so…
class Blah
{
public:
static HRESULT SomeCallback (…);
static int YayIAmStatic;
.
.
.
}
This compiles ok, but when I try to access the static member (from within the static callback or any other regular method) I get the following linker error:
unresolved external symbol "public: static int Blah::YayIAmStatic"
Is this not the appropriate syntax for creating a static member? Please humour a poor newbie – this is my first crack at an MFC program.
|
|
|
|
|
To declare a static variable in class Blah, put the statement in the header, as you have, then in the .cpp file put
int Blah::YayIAmStatic;
As it stands, you've told the compiler there is going to be a static int, but you've not created it.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I am doing a project related to video/image processing in Win32 environment.
Now, I would do something like printing a bitmap file. The input parameter I get would be "standard bitmap format" data (ex: a buffer like BYTE*). So, how can I do with this buffer (ex: BYTE* ) and print the bitmap format to printer ?
Any response would be greatly appreciated !
|
|
|
|
|
A printer has a DC, you simply StretchBlt it from a DC containing your bitmap to the printer. You will *always* stretch it, because otherwise the image will be smaller than a postage stamp. Don't forget to set the COLORONCOLOR StretchBlt mode.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Christian, can you explain your answer a little bit more, cos I have had this problem on my app. I managed to fix it by stretchblt'ing it with an offset, however this only worked for my PC. I recently tested it on someone else's PC and it was like a postage stamp despite my offset. Again, ur input would be much appreciated,
Alan.
P.S. did u fix that problem you had with the min/max track size of the child window (where it wouldn`t resize below a 100?) cos I posted a reply, but I think u must've solved it by that time.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
You actually need to find out the size of the print DC for the specific printer you are working with. Also, some HP printers do not report this correctly if you're using DirectX, we spoke to HP about this and they said they know about the problem, but they will only fix it *in our app* ( they admit the problem is their drivers ) if we give them all our source code and a pile of money.
I do it like this:
CPrintDialog dlg(false);
dlg.GetDefaults();
HDC hdc = dlg.GetPrinterDC();
ASSERT(hdc);
CDC DC;
DC.Attach(hdc);
m_PrintAreaHorz = GetDeviceCaps(hdc, HORZRES);
m_PrintAreaVert = GetDeviceCaps(hdc, VERTRES);
DC.DeleteDC();
which gives me the width and height I need to stretch to in order to fill the page. This should work for any printer, that is, if you stretch to these co-ordinates ( you'll obviously not want to, for aspect ratio reasons as much as anything ), you will fill the printable area of the page on any size/DPI printer.
Chambers wrote:
P.S. did u fix that problem you had with the min/max track size of the child window (where it wouldn`t resize below a 100?) cos I posted a reply, but I think u must've solved it by that time.
No, I've left it for now. For some reasons the MinMax is right, but Windows is not letting me size down to a width of 50, it stops at 100. I think the problem is in our Python code, somewhere.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Thanks Christian, I`ve managed to get it going now, just hope it works on other PC's, wish me luck,
Many Thanks,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|