|
|
Format your code using the <pre></pre> tags.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi guys,
I trying to extract blocks of a grayscale image. I have to divide my image into 64 blocks(think of it like placing a 8x8 grid on top of it, therefore each block size is image width/8 and image height/8.) Can someone show me a sample code about this?
modified on Thursday, November 20, 2008 10:15 AM
|
|
|
|
|
berko3000 wrote: Can somebody explain me what I'm doing wrong ?
Not following the posting guidelines
1/ No meaningful subject. *EVERYONE'S* posting wanting help.
2/ not using the formatting (pre) tag, to make your code readable.
Also, your code seems to have a bunch of } 's, but no } 's... This may well be a formatting issue (see #2 above. It's for your own good too)
Iain.
|
|
|
|
|
You also deleted the post with the code that Iain responded to or else edited your initial post. Makes it hard for anyone else following along later to figure what you needed or what Iain was referring to.
Dave.
|
|
|
|
|
Member 4194593 wrote: You also deleted the post
No I didn't! I am insulted sir!
Iain.
|
|
|
|
|
Iain,
Please forgive me, I accidentally attached the answer to your post, but the "you" was referring to the original poster. I was just heaping more scorn on the OP because the first post no longer contained the info on which you commented.
Dave.
|
|
|
|
|
Hi, I need to find the port of a printer (not the parallel port). I have code which uses GetProfileString, but I don't think this is how it's supposed to be done. Is there any API call which will do what this does?
The code I have:
#define MyAppPrinterName "MyAppPrinterName"
void CWordAddin::AppendPrinterPort( char* szOurPrinter )
{
char szPort[150]; GetProfileString("PrinterPorts", MyAppPrinterName, "", szPort, 150);
int i, j;
for (i=0; szPort[i] != '\0' && szPort[i] != ','; i++); i++;
for (j=0; szPort[i] != '\0' && szPort[i] != ','; i++, j++)
szPort[j] = szPort[i];
szPort[j] = 0;
strcat(szOurPrinter, szPort);
}
CComQIPtr <<Word::_Application>> app = button->GetApplication();
char printer_name[150] = MyAppPrinterName " on "; AppendPrinterPort(printer_name);
app->PutActivePrinter(printer_name);
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
modified on Thursday, November 20, 2008 7:52 AM
|
|
|
|
|
You can use EnumPrinters[^] to retrieve information about available printers. The GetProfileString [^]call you were making is an old function that was used to read the Win.ini file. In modern Microsoft operating systems this function actually reads/writes to the registry. Although the function has not been officially deprecated I would not personally use it.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hello,
I want my button to be clicked only once and not twice.
What to do.
Thanks In Advance.
Dhiraj
|
|
|
|
|
How about disabling the button after the first click?
|
|
|
|
|
actually what i want is that the user can only fire single click event and not double click.
That is my meaning of disabling actually the button is not disabled but double click should not do any thing. It should not change its state.
|
|
|
|
|
As far as i know -and please correct me anyone if i am wrong- if the user doubleclicks your button you will get a click event at first. So at the first click you won't be able to know if the user will doubleclick or just singleclick. To be more clear on this, when the user doubleclicks your button, you get 2 command messages from the button and you either want only one of these or if a doubleclick was done you don't want any command messages at all?
|
|
|
|
|
u can use PreTranslateMessage(MSG* pMsg) like this
BOOL [ur class name]::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDBLCLK:
pMsg->message = WM_LBUTTONDOWN;
break;
}
return 0;
}
|
|
|
|
|
Just add both a single-click handler and a double-click handler to the button, and do nothing for a double click.
|
|
|
|
|
or simply call the single-click handler from the double-click handler
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
He said he wants it to do nothing on a double click.
|
|
|
|
|
That is fine if that is what he wants. But I was thinking of the user who will start rapidly clicking the button only to find that every other click does not work as expected.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
you can use Pretranslatemessage method
BOOL <your class="" name="">::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDBLCLK:
pMsg->message = WM_LBUTTONDOWN;
break;
}
return 0;
}
or
u can map lbuttondblclk and then post a message of WM_LBUTTONDOWN(best for activex button controls)
|
|
|
|
|
How about simply removing the double click style from the window's class?
BOOL YourButtonClass::PreCreateWindow(CREATESTRUCT &cs)
{
WNDCLASS wndClass = { 0 };
GetClassInfo(NULL, cs.lpszClass, &wndClass);
wndClass.style &= ~CS_DBLCLKS;
wndClass.lpszClassName = _T("BUTTON-DBLCLKS");
if (AfxRegisterClass(&wndClass))
{
cs.lpszClass = wndClass.lpszClassName;
}
return __super::PreCreateWindow(cs);
}
|
|
|
|
|
Hello All
I am building my project Visual Studio.Net 2003. It is a big project that inturn consists of 83 small projects.....during the compilation of some project i am getting the error:
Project : error PRJ0019: A tool returned an error code: "Performing Pre-Build Event..."
Please suggest how this can be fixed.
waiting for suggestions.
|
|
|
|
|
In the project's property pages check out Build Events->Pre-build event and see what might be causing the problem.
|
|
|
|
|
How to place a button control over a picture control or some other control
|
|
|
|
|
You mean programatically? Well, you can make the picture control the parent of the button or you can use SetWindowPos to setup a Z-Order in which the button is over the picture control. Also if you choose to do the later, have the WS_CLIPSIBLINGS style set on your picture control.
|
|
|
|