|
Hi,
It is giving a lot of errors and warnings. It is giving errors in functional header. I am using VC6
Karteek
|
|
|
|
|
karteek wrote:
It is giving errors in functional header
In <functional>? Probably not.
This might be where the compiler gives up, but the error is in your code. DoO you have an example of your code that gives an error?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
hi there..
Thanks for the time firstly..
I wanted to know how can u add a shared menu to your active x control..also do we need to attach a verb to be able to use Shared Menus?
kind regards
safee
|
|
|
|
|
How do I change the value at certain positions in
a TCHAR*?
If I do..
TCHAR* pStr = _T("Bo Hunter");
pStr[pos] = _T('O');
it breaks with access violation.
If I do..
TCHAR szStr[MAX_SIZE] = {0};
lstrcpy(szStr, _T("Bo Hunter"));
szStr[pos] = _T('O');
it works.
Thank You
Bo Hunter
|
|
|
|
|
pStr[pos] = _T('O');
shouldnt it be
*pStr[pos] = _T('O');
or
*(pStr + pos) = _T('O');
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
I tried all of that before.
// Illegal indirection
*pStr[pos] = _T('O');
// Access violation writing location 0x0049924d.
*(pStr + pos) = _T('O');
I am within the bounds of the string for sure.
pStr starts at 0x0049924c
I thought for sure that
*(pStr + pos) = 'O';
was wright.
Thank You
Bo Hunter
|
|
|
|
|
Bo Hunter wrote:
TCHAR* pStr = _T("Bo Hunter");
Now pStr holds the adress of the constant string somwhere in the code. This memory is not writable. You need to copy the string to a writable location, either on the stack (as you did in your second example), or on the heap (by allocating memory using new ).
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
hi!
i'm trying to get the number of jobs that in queue of a shared printer.
i used the code that shows in the MSDN:
<br />
BOOL GetJobs(HANDLE hPrinter, JOB_INFO_2 **ppJobInfo, <br />
int *pcJobs, DWORD *pStatus) <br />
{ <br />
DWORD cByteNeeded,<br />
nReturned,<br />
cByteUsed;<br />
<br />
JOB_INFO_2 *pJobStorage = NULL;<br />
PRINTER_INFO_2 *pPrinterInfo = NULL; <br />
<br />
if (!GetPrinter(hPrinter, 2, NULL, 0, &cByteNeeded))<br />
{<br />
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)<br />
return FALSE;<br />
} <br />
pPrinterInfo = (PRINTER_INFO_2 *)malloc(cByteNeeded);<br />
if (!(pPrinterInfo))<br />
<br />
return FALSE; <br />
if (!GetPrinter(hPrinter,2,(LPBYTE)pPrinterInfo,cByte<br />
Needed,&cByteUsed))<br />
{<br />
<br />
free(pPrinterInfo);<br />
pPrinterInfo = NULL;<br />
return FALSE;<br />
} <br />
TRACE("NUM OF PRINT JOBS: %d\n",pPrinterInfo->cJobs);<br />
if (!EnumJobs(hPrinter,0,pPrinterInfo->cJobs,2,NULL,0,(LPDWORD)&cByteNeeded,(LPDWORD)&nReturned))<br />
{<br />
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)<br />
{<br />
free(pPrinterInfo);<br />
pPrinterInfo = NULL;<br />
return FALSE;<br />
}<br />
}<br />
pJobStorage = (JOB_INFO_2 *)malloc(cByteNeeded);<br />
if (!pJobStorage)<br />
{<br />
<br />
free(pPrinterInfo);<br />
pPrinterInfo = NULL;<br />
return FALSE;<br />
}<br />
ZeroMemory(pJobStorage, cByteNeeded); <br />
if (!EnumJobs(hPrinter,0,pPrinterInfo->cJobs,2,(LPBYTE)pJobStorage,cByteNeeded,(LPDWORD)&cByteUsed,(LPDWORD)&nReturned))<br />
{<br />
free(pPrinterInfo);<br />
free(pJobStorage);<br />
pJobStorage = NULL;<br />
pPrinterInfo = NULL;<br />
return FALSE;<br />
} <br />
*pcJobs = nReturned;<br />
*pStatus = pPrinterInfo->Status;<br />
*ppJobInfo = pJobStorage;<br />
free(pPrinterInfo);<br />
return TRUE; <br />
}<br />
This code returns the number of jobs, and a pointer to JOB_INFO_2 struct.
i'm using this code to clear the queue list of the printer:
<br />
JOB_INFO_2* jobs;<br />
int noj;<br />
DWORD status;<br />
BOOL err=false;<br />
if (err=GetJobs(hPrinter, &jobs, &noj, &status))<br />
{<br />
for (int j=0;j<(int)noj;j++)<br />
{<br />
SetJob(hPrinter, jobs[j].JobId, 0, NULL, JOB_CONTROL_DELETE);<br />
}<br />
free(jobs);<br />
}<br />
but if this printer is a shared printer (from another computer), some times i get num of jobs = 0, and some times the correct one.
most of the times, if i'm F11ing (stepping into) the GetJobs function it works, but if i just do F10 it returns num of jobs = 0. i tried to move the little yellow arrow (in VC++ .net) to the command and do it again, and after 2-3 times it return the correct num of jobs...
Is it a RPC error?
What can i do?!
thanks,
InfraRed
|
|
|
|
|
Hi,
I have a list box in my dialog.When I click a button called delete in my dialog box it should delete the selected item in the list box.How do I do this?
Karteek
|
|
|
|
|
CListCtrl* pListCtrl = (CListCtrl*) GetDlgItem(IDC_YOURLISTCONTROL);
ASSERT(pListCtrl != NULL);
POSITION pos = pList->GetFirstSelectedItemPosition();
if (pos == NULL)
TRACE0("No items were selected!\n");
else
{
while (pos)
{
int nItem = pList->GetNextSelectedItem(pos);
TRACE1("Item %d was selected!\n", nItem);
// you could do your own processing on nItem here
}
}
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Hi,
I tried this.But I am getting the nItem value as 0 always though I am selecting items at different postions in the list.
Karteek
|
|
|
|
|
Another method is to iterate throught each item in the list and check wheather it is selected or not.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
If you are using MFC:
int nIndex = listbox.GetCurSel();
listbox.DeleteString(nIndex);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi guys
I have a problem similar to this>
There is class A which is derived from CDialog.
I have no. of other classes which are derived from class A for creating dialog boxes.
I need to handle keyboard events in my dialog boxes.
If I add ON_WM_SYSCOMMAND()message and following functions in class A
void A::DoDataExchange(CDataExchange* pDX)
{
A::DoDataExchange(pDX);
}
and then handle keyboard events in
BOOL A::PreTranslateMessage(MSG* pMsg)
{
QB_ASSERT( pMsg, return FALSE;);
if (pMsg->message == WM_KEYDOWN)
{
if (pMsg->wParam == VK_F1 || pMsg->wParam == VK_ESCAPE)
{
//I will handle my keyboard event here
}
}
return CDialog::PreTranslateMessage(pMsg);
} //A::PreTranslateMessage
Will i be able to handle keyboard events in my classes that are derived from class A. I don;t want to add the redunudant code to my all derived classes.
Help me with your kind suggestions.
Regards
Chandok
|
|
|
|
|
|
Hey guys. I have a toolbar that I'm working on, and I've got it working just ducky except for a few things... I currently it have it redirect on a 404 or whatever to something like: http://www.mysite.com/404.html but I would like to not have it show the URL of the error page in the address bar... Even if I have to somehow make a dll or something that contains the custom 404/etc error messages, how can I go about doing so?
|
|
|
|
|
...could you explain why? Or more exactly, explain in satisfying detail that your toolbar is not one of those awful ad bars that i spend so much time cleaning off of relatives' computers.
Shog9
---
You'd better turn back, before the frost sets in.
These desert nights are for weathered men,
The ones who've already given in...
|
|
|
|
|
*laugh* Hell no. It's actually going to be for a game of mine that I run, and it's going to give people stats about the game etc. :P It's not an ad bar by any means. :P
|
|
|
|
|
Vermithrax wrote:
It's not an ad bar by any means.
Kewl. Well, not sure where you're intercepting the 404, but responding with a 302 that redirects to your page sounds like the way to go.
Shog9
---
You'd better turn back, before the frost sets in.
These desert nights are for weathered men,
The ones who've already given in...
|
|
|
|
|
Ok.. Now will that send me to the custom 404 page and leave the original address in the address bar?
|
|
|
|
|
As i understand it, it *should*. Now, whether IE actually does this or not... *shrug*
Shog9
---
You'd better turn back, before the frost sets in.
These desert nights are for weathered men,
The ones who've already given in...
|
|
|
|
|
Unfortunately that code redirects just fine, but it shows the URL up top.. Which I don't want, I just want the site that they tried to get to up there in the address bar.
|
|
|
|
|
This is what my code looks like here:
void __stdcall CIEBand::OnNavigateError(IDispatch* pDisp, VARIANT* URL, VARIANT* TargetFrameName, VARIANT* StatusCode, VARIANT_BOOL* &Cancel)
{
if(StatusCode->intVal != HTTP_STATUS_OK)
{
CStringW c = "http://www.mysite.com/404.html";
VARIANT_BOOL topLevel;
if(m_pWb2 == pDisp && SUCCEEDED(m_pWb2->get_TopLevelContainer(&topLevel)) && topLevel)
{
m_pWb2->Stop();
m_pWb2->Navigate2(&CComVariant(c), &vtMissing, TargetFrameName, &vtMissing, &vtMissing);
}
}
}
|
|
|
|
|
I'm not sure... I have my code below, and I'm not quite sure that'll work...
|
|
|
|
|
Well... can't give you a good solution, but here's a hack that might do for you. Navigate to this URL (replacing winamp.com with whatever):
javascript:document.write('<body style=\"overflow:hidden;margin:0px;padding:0px;border:none;\"><iframe src=\"http://www.winamp.com/\" style=\"margin:0px;padding:0px;border:none;width:100%;height:100%;\"></iframe></body>')
Shog9
---
You'd better turn back, before the frost sets in.
These desert nights are for weathered men,
The ones who've already given in...
|
|
|
|